/* =====================================================================
   Market Panel - Exchange Overlay
   Reuses .overlay-panel base from profile-core.css and shared rp-*
   structural classes from realm-briefing.css.
   ===================================================================== */

#market-panel {
    background: #070b10;
}

#market-panel .rp-banner {
    background: #05070a url(/assets/screen-exchange-Dvr9uy-Q.avif) left top / contain no-repeat;
    background-size: auto 315px;
}

#market-panel.market-panel--open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

/* ── Item detail sub-view ─────────────────────────────────────────── */

.mkt-detail-crumbs {
    margin: 0 0 18px;
}

.mkt-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.mkt-detail-icon {
    flex-shrink: 0;
    width: 3.2rem;
    height: 3.2rem;
}

.mkt-detail-desc {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    margin: 4px 0 0;
    line-height: 1.45;
}

.mkt-detail-book {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.mkt-detail-col {
    min-width: 0;
}

.mkt-detail-col-label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.15);
}

.mkt-detail-fills {
    margin-bottom: 24px;
}

.mkt-detail-buy-btn {
    color: var(--gold);
    border-color: rgba(197, 160, 89, 0.4);
}

.mkt-td--right {
    text-align: right;
}

.mkt-th--right {
    text-align: right;
}

/* ── Exchange ticker tape ─────────────────────────────────────────── */
.mkt-ticker {
    position: relative;
    overflow: hidden;
    height: 34px;
    margin: 0 0 16px;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
    border-bottom: 1px solid rgba(197, 160, 89, 0.1);
    background: rgba(197, 160, 89, 0.02);
}
.mkt-ticker::before,
.mkt-ticker::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
}
.mkt-ticker::before {
    left: 0;
    background: linear-gradient(to right, rgba(7, 8, 13, 0.95), transparent);
}
.mkt-ticker::after {
    right: 0;
    background: linear-gradient(to left, rgba(7, 8, 13, 0.95), transparent);
}
.mkt-ticker__track {
    display: inline-flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
    animation: mkt-ticker-tape var(--mkt-ticker-duration, 60s) linear infinite;
    will-change: transform;
}
@keyframes mkt-ticker-tape {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}
@media (prefers-reduced-motion: reduce) {
    .mkt-ticker__track {
        animation: none;
    }
}
.mkt-ticker:hover .mkt-ticker__track {
    animation-play-state: paused;
}
.mkt-ticker__pip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 22px;
    border-right: 1px solid rgba(197, 160, 89, 0.08);
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    cursor: pointer;
}
.mkt-ticker__pip:hover {
    color: var(--text-primary);
}
.mkt-ticker__icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.85;
}
.mkt-ticker__sym {
    color: var(--text-gold);
    font-family: var(--font-heading);
    font-weight: 700;
}
.mkt-ticker__price {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* =====================================================================
   Market Exchange - table, filters, cards, status badges
   (migrated from market-lab.css / market-lab-2.css)
   ===================================================================== */

/* ── Title row ────────────────────────────────────────────────────── */
.rp-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

/* ── Tab panes ───────────────────────────────────────────────────── */
.mkt-tab-pane {
    display: none;
}
.mkt-tab-pane--active {
    display: block;
}

/* ── Content body ─────────────────────────────────────────────────── */
.mkt-body {
    flex: 1;
}

/* ── Search + category filters ───────────────────────────────────── */
.mkt-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 25px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.mkt-bcard-header {
    width: 100%;
}
.mkt-bcard-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.mkt-search {
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    width: 100%;
    outline: none;
    flex: 0 0 100%;
    box-sizing: border-box;
}
.mkt-search::placeholder {
    color: var(--text-muted);
}
.mkt-cat-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 5px;
    opacity: 0.7;
    flex-shrink: 0;
}
.mkt-cat-btn--active .mkt-cat-icon {
    opacity: 1;
}

.mkt-cat-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: 500;
    height: 30px;
    padding: 0 12px;
    transition: all 0.12s;
}
.mkt-cat-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.mkt-cat-btn--active {
    background: rgba(200, 169, 110, 0.12);
    border-color: rgba(200, 169, 110, 0.45);
    color: var(--accent-gold, #c8a96e);
}

/* ── Table ────────────────────────────────────────────────────────── */
.mkt-table {
    width: 100%;
    border-collapse: collapse;
}
.mkt-table--fixed {
    table-layout: fixed;
}
.mkt-table thead tr {
    border-bottom: 2px solid rgb(46, 40, 28);
}
.mkt-th {
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mkt-th--right {
    text-align: right;
}
.mkt-th--center {
    text-align: center;
}
.mkt-td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: var(--font-size-md);
    vertical-align: middle;
    color: var(--text-muted);
}
.mkt-td--right {
    text-align: right;
}
.mkt-td--center {
    text-align: center;
}
.mkt-td--val {
    color: #7a6040;
}
.mkt-row {
    cursor: pointer;
    transition: background 0.12s;
}
.mkt-row:hover {
    background: rgba(197, 160, 89, 0.04);
}
.mkt-row--selected {
    background: rgba(197, 160, 89, 0.07);
}
.mkt-item-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 10rem;
}
.mkt-item-cell img {
    width: 50px;
    height: 50px;
}
.mkt-item-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 4px;
    background: rgba(197, 160, 89, 0.06);
    border: 1px solid rgba(197, 160, 89, 0.15);
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.mkt-item-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.mkt-item-icon .mkt-item-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.mkt-item-name {
    font-weight: 600;
    font-size: var(--font-size-md);
    color: var(--gold);
}
.mkt-item-category {
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}
.mkt-item-type {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}
.mkt-price-main {
    color: var(--text-muted);
    font-weight: 600;
}
.mkt-spread-flat {
    color: var(--text-muted);
}
.mkt-volume {
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.mkt-trend {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: var(--font-size-base);
}
.mkt-trend--up {
    color: #4caf50;
}
.mkt-trend--down {
    color: #e05252;
}
.mkt-trend--flat {
    color: var(--text-muted);
}
.mkt-trend-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}
.mkt-coin-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}
.mkt-sparkline {
    display: block;
    overflow: visible;
}
.mkt-td--center .mkt-sparkline {
    margin: 0 auto;
}
.mkt-item-icon-sm {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ── Status badges ────────────────────────────────────────────────── */
.mkt-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.mkt-status--high {
    background: rgba(76, 175, 80, 0.12);
    color: #6fcf73;
    border: 1px solid rgba(76, 175, 80, 0.2);
}
.mkt-status--stable {
    background: rgba(197, 160, 89, 0.1);
    color: var(--gold);
    border: 1px solid rgba(197, 160, 89, 0.18);
}
.mkt-status--low {
    background: rgba(224, 82, 82, 0.1);
    color: #e07070;
    border: 1px solid rgba(224, 82, 82, 0.18);
}
.mkt-status--abundant {
    background: rgba(76, 175, 80, 0.15);
    color: #6fcf73;
    border: 1px solid rgba(76, 175, 80, 0.25);
}

/* ── Bottom cards ─────────────────────────────────────────────────── */
#mkt-tab-exchange {
    container-type: inline-size;
    container-name: mkt-exchange;
}
.mkt-bottom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}
@container mkt-exchange (max-width: 680px) {
    .mkt-bottom {
        grid-template-columns: 1fr;
    }
}
.mkt-bcard {
    position: relative;
    background: rgba(197, 160, 89, 0.02);
    border: 1px solid rgba(197, 160, 89, 0.25);
    outline: 1px solid rgba(197, 160, 89, 0.08);
    outline-offset: 4px;
    border-radius: var(--radius-md);
    padding: 12px 14px;
}
.mkt-bcard::before,
.mkt-bcard::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: rgba(197, 160, 89, 0.35);
    border-style: solid;
}
.mkt-bcard::before {
    top: -2px;
    left: -2px;
    border-width: 1px 0 0 1px;
}
.mkt-bcard::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 1px 1px 0;
}
.mkt-bcard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mkt-bcard-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.mkt-bcard-link {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    cursor: pointer;
}
.mkt-bcard-link:hover {
    color: var(--gold);
}
.mkt-bcard-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-style: italic;
}
.mkt-bcard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    font-size: var(--font-size-sm);
}
.mkt-bcard-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}
.mkt-bcard-val {
    color: #686b6e;
    font-size: var(--font-size-base);
    font-variant-numeric: tabular-nums;
}
.mkt-bcard-val--green {
    color: #4caf50;
}
.mkt-bcard .mkt-td {
    padding: 5px 6px;
    font-size: var(--font-size-base);
    height: 38px;
    box-sizing: border-box;
}
.mkt-bcard .mkt-th {
    padding: 4px 6px;
    font-size: var(--font-size-xs);
}
.mkt-bcard .mkt-item-icon {
    width: 1.5rem;
    height: 1.5rem;
}
.mkt-bcard .mkt-item-name {
    font-size: var(--font-size-base);
}
.mkt-bcard .mkt-coin-icon {
    width: 14px;
    height: 14px;
}
.mkt-bcard .mkt-item-icon-sm {
    width: 14px;
    height: 14px;
}
.mkt-bcard-footer {
    margin-top: 10px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: right;
}
.mkt-supply-ratio {
    color: #4caf50;
    font-variant-numeric: tabular-nums;
}
.mkt-supply-arrow {
    font-size: 0.75em;
    color: #4caf50;
}
.mkt-spread-pct-val {
    color: #e05252;
    font-variant-numeric: tabular-nums;
}
.mkt-trade-seller,
.mkt-trade-buyer,
#market-panel [data-player-name] {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    cursor: pointer;
}
#market-panel [data-player-name]:hover {
    color: var(--text-gold);
    text-decoration: underline;
}
.mkt-trade-arrow {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin: 0 4px;
}
.mkt-placeholder {
    padding: 48px 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.mkt-view-more {
    display: flex;
    justify-content: center;
    padding: 16px 0 8px;
}

.mkt-claim-undocked {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-style: italic;
}

/* =====================================================================
   Item Detail - Production (Lab 3 layout, mkt-detail-* prefix)
   ===================================================================== */

/* ── Stats header bar (6-column grid) ─────────────────────────────── */
.mkt-detail-stats {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(5, 1fr);
    overflow: hidden;
    margin-bottom: 4px;
}
.mkt-detail-stats-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 0px 18px;
    min-width: 0;
}
.mkt-detail-stats-cell + .mkt-detail-stats-cell {
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.mkt-detail-stats-ident {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    justify-content: flex-start;
    padding-left: 0;
}
.mkt-detail-stats-ident[data-mkt-open-item-detail] {
    cursor: pointer;
}
.mkt-detail-stats .mkt-item-icon {
    width: 6.2rem;
    height: 6.2rem;
}
.mkt-detail-stats-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.mkt-detail-stats-val {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}
.mkt-detail-stats-val strong {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    color: var(--text-gold);
}
.mkt-detail-stats-sub {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* ── Two-page spread layout ────────────────────────────────────────── */
.mkt-detail-spread {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) 1px minmax(0, 1.1fr);
    gap: 32px;
    align-items: flex-start;
    margin-top: 4px;
}
.mkt-detail-page {
    padding: 24px 28px;
    background: rgba(197, 160, 89, 0.015);
    border: 1px solid rgba(197, 160, 89, 0.12);
    border-radius: 4px;
    min-width: 0;
}
.mkt-detail-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.mkt-detail-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.mkt-detail-page--left {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mkt-detail-spine {
    width: 1px;
    min-height: 480px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(197, 160, 89, 0.35) 15%,
        rgba(197, 160, 89, 0.45) 50%,
        rgba(197, 160, 89, 0.35) 85%,
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(197, 160, 89, 0.08);
}
.mkt-detail-eyebrow {
    font-size: var(--font-size-xs);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.55);
    font-family: var(--font-heading);
    margin-bottom: 10px;
}
.mkt-detail-order-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.65);
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.12);
    margin: 0 0 4px;
}
.mkt-detail-subtitle {
    margin: 4px 0 6px;
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    color: var(--text-gold);
    letter-spacing: 0.04em;
}
.mkt-detail-rule {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(197, 160, 89, 0.3), transparent);
    margin: 2px 0;
}

/* ── Mid-price divider row ─────────────────────────────────────────── */
.mkt-detail-mid-cell {
    padding: 0;
}
.mkt-detail-book-table .mkt-td {
    color: var(--text-primary);
}
.mkt-detail-book-table .mkt-book-cancel {
    min-width: 0;
    width: 28px;
    padding: 0;
}
.mkt-detail-book-table .mkt-col--location {
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mkt-detail-mid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 0;
    margin: 6px 0;
    border-top: 1px solid rgba(197, 160, 89, 0.3);
    border-bottom: 1px solid rgba(197, 160, 89, 0.3);
    background: rgba(197, 160, 89, 0.04);
}
.mkt-detail-mid-em {
    color: rgba(197, 160, 89, 0.35);
    letter-spacing: 0.3em;
}
.mkt-detail-mid-label {
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    letter-spacing: 0.3em;
    color: var(--text-gold);
}
.mkt-detail-mid-price {
    font-family: var(--font-heading);
    font-size: var(--font-size-2xl);
    color: var(--text-gold);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

/* ── Trade module ──────────────────────────────────────────────────── */
.mkt-detail-trade {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.mkt-detail-trade-side {
    display: flex;
    gap: 4px;
}
.mkt-detail-trade-side .panel-tab {
    flex: 1;
    text-align: center;
    padding: 1rem;
}
.mkt-detail-trade-mode {
    display: flex;
    gap: 6px;
}
.mkt-detail-trade-mode .mkt-cat-btn {
    flex: 1;
    text-align: center;
}
.mkt-detail-trade-side--sell {
    background: rgba(224, 82, 82, 0.15);
    border-color: rgba(224, 82, 82, 0.35);
    color: #e07070;
}
.mkt-detail-trade-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.mkt-detail-trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.mkt-detail-trade-row__label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: 100px;
}
.mkt-detail-trade-row__val {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    font-variant-numeric: tabular-nums;
    color: var(--text-gold);
    min-width: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mkt-detail-qty-row {
    flex: 1;
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}
.mkt-detail-trade-total {
    border-top: 1px solid rgba(197, 160, 89, 0.18);
    border-bottom: 1px solid rgba(197, 160, 89, 0.18);
    padding: 8px 0;
    margin: 2px 0;
}
.mkt-detail-trade-total .mkt-detail-trade-row__val {
    font-size: var(--font-size-xl);
}
.mkt-detail-cta {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(197, 160, 89, 0.28);
    border-radius: 3px;
    color: rgba(220, 200, 160, 0.9);
    font-family: var(--font-heading);
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s;
}
.mkt-detail-cta:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(197, 160, 89, 0.45);
}
.mkt-detail-cta--sell {
    border-color: rgba(197, 160, 89, 0.28);
}
.mkt-detail-cta--sell:hover {
    border-color: rgba(197, 160, 89, 0.45);
}
.mkt-detail-helper {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    font-style: italic;
}

/* ── Order book price column ───────────────────────────────────────── */
.mkt-detail-order-price {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* ── Empty state cell ──────────────────────────────────────────────── */
.mkt-empty {
    color: var(--text-muted);
}

/* ── Instant-fill row tint (--mkt-fill-opacity: 0.12–0.28 by consumed share) */
.mkt-row.mkt-row--fill-buy > .mkt-td {
    background-color: rgba(var(--market-buy-rgb), var(--mkt-fill-opacity, 0));
}
.mkt-row.mkt-row--fill-sell > .mkt-td {
    background-color: rgba(var(--market-sell-rgb), var(--mkt-fill-opacity, 0));
}

/* ── Responsive breakpoints ────────────────────────────────────────── */

/* Collapse the two-page spread to a single column.
   The panel is much narrower than the viewport (nav + right sidebar consume
   ~40% of viewport width), so we need a higher breakpoint than the lab which
   ran full-viewport. 1500px matches the lab's threshold while accounting for
   panel constraints, keeping two columns only at wide desktop (1280px+). */
@media (max-width: 1500px) {
    .mkt-detail-spread {
        grid-template-columns: 1fr;
    }
    .mkt-detail-spine {
        display: none;
    }
    .mkt-detail-left-col,
    .mkt-detail-right-col {
        display: contents;
    }
    .mkt-detail-left-col > .mkt-detail-page:first-child {
        order: 1;
    }
    .mkt-detail-right-col > .mkt-detail-page:first-child {
        order: 2;
    }
    .mkt-detail-right-col > .mkt-detail-page:last-child {
        order: 3;
    }
    .mkt-detail-left-col > .mkt-detail-page:last-child {
        order: 4;
    }
}

/* Stats header: identity + 2 stat columns, cells 4-6 wrap to row 2 */
@media (max-width: 1100px) {
    .mkt-detail-stats {
        grid-template-columns: minmax(0, 1.6fr) repeat(2, 1fr);
    }
    .mkt-detail-stats-cell:nth-child(n + 4) {
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mkt-detail-stats-cell {
        padding: 10px 12px;
    }
    .mkt-detail-stats-cell:nth-child(1),
    .mkt-detail-stats-cell:nth-child(4) {
        padding-left: 0;
    }
}

/* Browse table: hide Trend and Local Status columns on mobile */
@media (max-width: 900px) {
    .mkt-browse-table col:nth-child(6),
    .mkt-browse-table col:nth-child(7) {
        display: none;
    }
}

/* Stats header: all 6 cells in a 3-column equal-width grid */
@media (max-width: 900px) {
    .mkt-detail-stats.srl-card {
        padding: 10px 0px;
    }
    .mkt-detail-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .mkt-detail-stats-ident {
        grid-column: unset;
    }
    .mkt-detail-stats-cell + .mkt-detail-stats-cell {
        border-left: none;
    }
    .mkt-detail-stats-cell:nth-child(n + 4) {
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mkt-detail-stats-cell:nth-child(3n + 2),
    .mkt-detail-stats-cell:nth-child(3n + 3) {
        border-left: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mkt-detail-stats-cell {
        padding: 10px 12px;
    }
    .mkt-detail-stats-cell:nth-child(1),
    .mkt-detail-stats-cell:nth-child(4) {
        padding-left: 0;
    }
    .mkt-detail-stats .mkt-item-icon {
        width: 3.2rem;
        height: 3.2rem;
    }
}

/* Phone: tighter page padding and smaller identity icon */
@media (max-width: 640px) {
    .mkt-coin-icon {
        width: 17px;
        height: 17px;
    }
    .mkt-detail-page {
        padding: 16px;
    }
    .mkt-detail-stats .mkt-item-icon {
        width: 4.2rem;
        height: 4.2rem;
    }
    .mkt-detail-spread {
        gap: 16px;
    }
}

/* ── Mobile: hide Weekly Volume + Local Status columns from the main exchange table ── */
/* Use :has() to target the td, nth-child(5/7) for the th - scoped to the exchange tab */
@container mkt-exchange (max-width: 640px) {
    /* Weekly Volume - column 5 */
    #mkt-tab-exchange thead tr th:nth-child(5),
    #mkt-tab-exchange tbody tr td:has(.mkt-volume) {
        display: none;
    }
    /* Local Status - column 7 (6 after Weekly Vol is hidden, but nth-child counts original position) */
    #mkt-tab-exchange thead tr th:nth-child(7),
    #mkt-tab-exchange tbody tr td:has(.mkt-status) {
        display: none;
    }
}
