.markets-page { background: var(--warm-white); }
.markets-page .site-header { z-index: 60; }
.markets-page .primary-nav a[aria-current="page"] { color: var(--market-green); font-weight: 700; }
.markets-page .primary-nav a[aria-current="page"]::after { transform: scaleX(1); }
.markets-page button, .markets-page input, .markets-page table { font-family: Arial, Helvetica, sans-serif; }
.markets-container { width: min(calc(100% - (2 * var(--page-gutter))), 1392px); margin-inline: auto; }
.markets-label { margin: 0 0 17px; color: var(--market-green); font: 800 11px/1 Arial, Helvetica, sans-serif; letter-spacing: .12em; }

.markets-hero { min-height: 364px; padding: 82px 0 74px; display: flex; align-items: center; color: #fff; background: var(--forest-ink); }
.markets-hero__copy { max-width: 840px; }
.markets-hero .markets-label { color: var(--signal-lime); }
.markets-hero h1, .market-catalog__heading h2, .markets-info h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.035em; }
.markets-hero h1 { max-width: 820px; font-size: clamp(52px, 5.2vw, 82px); line-height: .96; }
.markets-hero__copy > p:last-child { max-width: 670px; margin: 27px 0 0; color: rgba(255,255,255,.76); font-size: 17px; line-height: 1.6; }

.featured-markets { padding: 22px var(--page-gutter); background: rgba(18, 59, 42, .12); }
.featured-markets__grid { max-width: 1392px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.featured-market { min-width: 0; min-height: 112px; padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; gap: 5px 12px; color: var(--text-ink); background: #fff; border: 1px solid var(--trade-line); border-radius: 3px; text-align: left; text-decoration: none; cursor: pointer; transition: background-color 180ms ease, border-color 180ms ease, transform 220ms cubic-bezier(.16,1,.3,1); }
.featured-market:hover { background: rgba(184, 238, 75, .1); border-color: var(--market-green); transform: translateY(-2px); }
.featured-market:active { transform: translateY(0); }
.featured-market:focus-visible { outline: 3px solid rgba(47,143,70,.25); outline-offset: 3px; }
.featured-market__pair { min-width: 0; color: var(--forest-ink); font-size: 14px; font-weight: 800; }
.featured-market__topline { grid-column: 1 / 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.featured-market__tier { color: var(--market-green); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.featured-market__price { align-self: end; color: var(--forest-ink); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.featured-market__change { align-self: end; color: var(--trade-muted); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.featured-market__meta { grid-column: 1 / 3; display: flex; justify-content: space-between; gap: 12px; color: var(--trade-muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.featured-market__meta .is-positive { color: var(--market-green-dark); }
.featured-market__meta .is-negative { color: var(--trade-sell); }
.featured-market__change.is-positive { color: var(--market-green-dark); }
.featured-market__change.is-negative { color: var(--trade-sell); }

.market-catalog { padding: 82px 0 96px; background: var(--warm-white); }
.market-catalog__heading { max-width: 830px; }
.market-catalog__heading h2 { max-width: 800px; color: var(--forest-ink); font-size: clamp(46px, 4.4vw, 70px); line-height: .98; }
.market-catalog__heading > p:last-child { max-width: 720px; margin: 25px 0 0; color: var(--muted-ink); font-size: 16px; line-height: 1.65; }

.market-controls { margin-top: 46px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--trade-line-strong); }
.market-filters { min-width: 0; display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: thin; }
.market-filters button { position: relative; min-width: 78px; min-height: 50px; padding: 0 15px; color: var(--trade-muted); background: transparent; border: 0; font-size: 12px; font-weight: 800; cursor: pointer; }
.market-filters button::after { content: ""; position: absolute; right: 14px; bottom: 0; left: 14px; height: 3px; background: var(--market-green); transform: scaleX(0); transform-origin: center; transition: transform 180ms ease; }
.market-filters button:hover { color: var(--forest-ink); background: rgba(184,238,75,.09); }
.market-filters button.is-active { color: var(--forest-ink); }
.market-filters button.is-active::after { transform: scaleX(1); }
.market-filters button:focus-visible { z-index: 1; outline: 3px solid rgba(47,143,70,.25); outline-offset: -3px; }
.market-search-control { flex: 0 0 min(340px, 31vw); height: 42px; margin-bottom: 7px; padding: 0 12px; display: flex; align-items: center; gap: 9px; color: var(--trade-muted); background: #fff; border: 1px solid var(--trade-line-strong); border-radius: 3px; }
.market-search-control:focus-within { border-color: var(--market-green); box-shadow: 0 0 0 3px rgba(47,143,70,.1); }
.market-search-control svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.market-search-control input { min-width: 0; width: 100%; height: 100%; color: var(--text-ink); background: transparent; border: 0; outline: 0; font-size: 13px; }
.market-search-control input::placeholder { color: #6f7b74; opacity: 1; }
.market-catalog__meta { min-height: 42px; padding: 0 3px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--trade-muted); font: 700 11px/1.4 Arial, Helvetica, sans-serif; scroll-margin-top: 92px; }

.market-table-shell { max-width: 100%; overflow-x: auto; background: #fff; border: 1px solid var(--trade-line); border-radius: 3px; outline: none; }
.market-table-shell:focus-visible { outline: 3px solid rgba(47,143,70,.2); outline-offset: 3px; }
.markets-table { width: 100%; min-width: 1160px; border-collapse: collapse; table-layout: fixed; color: var(--text-ink); font-size: 12px; font-variant-numeric: tabular-nums lining-nums; }
.markets-table th { height: 42px; padding: 0 11px; color: var(--trade-muted); background: var(--trade-panel-muted); border-bottom: 1px solid var(--trade-line-strong); font-size: 11px; font-weight: 800; text-align: right; white-space: nowrap; }
.markets-table th:nth-child(2), .markets-table th:nth-child(3) { text-align: left; }
.markets-table th:nth-child(1) { width: 42px; }
.markets-table th:nth-child(2) { width: 158px; }
.markets-table th:nth-child(3) { width: 84px; }
.markets-table th:nth-child(10) { width: 92px; }
.markets-table th button { width: 100%; padding: 8px 0; display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; color: inherit; background: transparent; border: 0; font: inherit; cursor: pointer; }
.markets-table th:nth-child(2) button, .markets-table th:nth-child(3) button { justify-content: flex-start; }
.markets-table th button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.markets-table th[aria-sort="ascending"] button, .markets-table th[aria-sort="descending"] button { color: var(--forest-ink); }
.markets-table th[aria-sort="ascending"] button svg { transform: rotate(0); }
.markets-table th[aria-sort="descending"] button svg { transform: rotate(180deg); }
.markets-table th button:focus-visible { outline: 2px solid var(--market-green); outline-offset: 3px; }
.markets-table td { height: 46px; padding: 0 11px; border-bottom: 1px solid rgba(18,59,42,.09); text-align: right; white-space: nowrap; }
.markets-table tbody tr { cursor: pointer; transition: background-color 150ms ease; }
.markets-table tbody tr:hover, .markets-table tbody tr:focus-within { background: rgba(184,238,75,.1); }
.markets-table tbody tr[data-charted="true"] { background: rgba(184,238,75,.15); }
.markets-table tbody tr[data-charted="true"] td:first-child { box-shadow: inset 3px 0 0 var(--market-green); }
.markets-table tfoot td { height: auto; padding: 0; background: var(--trade-panel-muted); border-bottom: 0; text-align: center; }
.markets-table td:nth-child(2), .markets-table td:nth-child(3) { text-align: left; }
.market-save-button { width: 30px; height: 32px; display: grid; place-items: center; color: var(--trade-muted); background: transparent; border: 0; cursor: pointer; }
.market-save-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.market-save-button.is-saved { color: var(--market-green-dark); }
.market-save-button.is-saved svg { fill: var(--signal-lime); }
.market-save-button:focus-visible { outline: 2px solid var(--market-green); outline-offset: 1px; }
.market-pair { color: var(--forest-ink); font-size: 13px; font-weight: 800; }
.market-pair small { margin-left: 7px; color: var(--trade-muted); font-size: 10px; font-weight: 700; }
.market-tier-badge { display: inline-flex; min-height: 24px; padding: 0 8px; align-items: center; color: var(--trade-muted); background: var(--trade-panel-muted); border: 1px solid var(--trade-line); border-radius: 2px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.market-tier-badge--top, .market-tier-badge--active { color: var(--market-green-dark); background: rgba(47,143,70,.07); }
.market-change.is-positive { color: var(--market-green-dark); font-weight: 800; }
.market-change.is-negative { color: var(--trade-sell); font-weight: 800; }
.market-action { min-height: 30px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--forest-ink); background: var(--signal-lime); border: 1px solid rgba(18,59,42,.28); border-radius: 3px; font-size: 11px; font-weight: 800; text-decoration: none; cursor: pointer; transition: color 150ms ease, background-color 150ms ease, transform 150ms ease; }
.market-action:hover { color: #fff; background: var(--market-green); transform: translateY(-1px); }
.market-action:active { transform: translateY(0); }
.market-action:focus-visible { outline: 3px solid rgba(47,143,70,.25); outline-offset: 2px; }
.markets-loading, .markets-empty { height: 150px !important; color: var(--trade-muted); text-align: center !important; }
.market-pagination { min-height: 62px; padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.market-pagination[hidden] { display: none; }
.market-pagination button { min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; color: var(--trade-muted); background: #fff; border: 1px solid var(--trade-line-strong); border-radius: 3px; font-size: 12px; font-weight: 800; cursor: pointer; transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease; }
.market-pagination button:hover:not(:disabled) { color: var(--forest-ink); border-color: var(--market-green); background: rgba(184,238,75,.1); }
.market-pagination button.is-active { color: var(--forest-ink); background: var(--signal-lime); border-color: var(--market-green); }
.market-pagination button:disabled { color: #9aa49e; background: #eef0eb; cursor: not-allowed; }
.market-pagination button:focus-visible { outline: 3px solid rgba(47,143,70,.25); outline-offset: 2px; }
.market-pagination__direction { min-width: 88px !important; }

.markets-info { padding: 86px var(--page-gutter) 92px; color: var(--forest-ink); background: #fff; border-top: 1px solid var(--line); }
.markets-info__inner { max-width: 1120px; margin: 0 auto; }
.markets-info h2 { max-width: 780px; font-size: clamp(46px,5vw,70px); line-height: .96; }
.markets-info__inner > p:nth-of-type(2) { max-width: 700px; margin: 28px 0 0; color: var(--muted-ink); font-size: 16px; line-height: 1.65; }

@media (max-width: 1100px) {
  .featured-markets__grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .market-controls { align-items: stretch; flex-direction: column; border-bottom: 0; }
  .market-filters { border-bottom: 1px solid var(--trade-line-strong); }
  .market-search-control { width: 100%; flex-basis: 44px; margin: 0; }
}

@media (max-width: 620px) {
  .markets-container { width: calc(100% - 32px); }
  .markets-hero { min-height: 330px; padding: 58px 0 54px; }
  .markets-hero h1 { font-size: clamp(44px,12.5vw,58px); }
  .markets-hero__copy > p:last-child { font-size: 15px; }
  .featured-markets { padding: 14px 0; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .featured-markets__grid { width: max-content; padding: 0 16px; display: flex; gap: 10px; }
  .featured-market { width: 286px; flex: 0 0 286px; scroll-snap-align: start; }
  .market-catalog { padding: 62px 0 72px; }
  .market-catalog__heading h2 { font-size: clamp(42px,12vw,55px); }
  .market-catalog__heading > p:last-child { font-size: 15px; }
  .market-controls { margin-top: 34px; gap: 14px; }
  .market-filters button { min-width: 72px; }
  .market-catalog__meta { min-height: 54px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 4px; }
  .market-table-shell { overflow: hidden; }
  .markets-table { min-width: 0; table-layout: fixed; }
  .markets-table th, .markets-table td { padding: 0 6px; font-size: 10px; }
  .markets-table th:nth-child(1) { width: 34px; }
  .markets-table th:nth-child(2) { width: 38%; }
  .markets-table th:nth-child(4) { width: 28%; }
  .markets-table th:nth-child(10) { width: 25%; }
  .markets-table th:nth-child(3), .markets-table td:nth-child(3), .markets-table th:nth-child(5), .markets-table td:nth-child(5), .markets-table th:nth-child(n+6):nth-child(-n+9), .markets-table td:nth-child(n+6):nth-child(-n+9) { display: none; }
  .markets-table th:nth-child(2) button { justify-content: flex-start; }
  .market-pair { font-size: 11px; }
  .market-pair small { display: none; }
  .market-action { min-height: 32px; padding: 0 7px; font-size: 10px; }
  .market-pagination { min-height: 58px; padding-inline: 8px; gap: 4px; }
  .market-pagination button { min-width: 32px; height: 34px; padding-inline: 7px; }
  .market-pagination__direction { min-width: 0 !important; }
  .market-pagination__direction span { display: none; }
  .markets-info { padding: 66px 22px 72px; }
  .markets-info h2 { font-size: clamp(43px,13vw,56px); }
  .wallet-dialog { padding: 24px; }
  .wallet-dialog h2 { font-size: 25px; }
  .wallet-dialog__actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .featured-market, .market-action { transition-duration: 80ms; }
  .featured-market:hover, .market-action:hover { transform: none; }
}
