*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f6f4ef 46%, #eef5f2 100%);
    color: #131416;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.text-up {
    color: #16823a;
}

.text-down {
    color: #be123c;
}

.text-neutral {
    color: #74777f;
}

.crypto-wrapper {
    width: 100%;
    max-width: 1180px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 78px 16px 0;
    display: flex;
    flex-direction: column;
}

.crypto-main {
    flex: 1;
    padding-bottom: 28px;
}

.market-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(460px, 1.08fr);
    gap: 14px;
    align-items: stretch;
    padding: 18px 0 14px;
}

.market-hero__copy,
.market-stats,
.highlight-card,
.market-tools,
.table-container,
.api-note {
    border: 1px solid rgba(19, 20, 22, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 28px rgba(19, 20, 22, 0.05);
}

.market-hero__copy {
    min-height: 148px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.market-eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.status-badge,
.update-time {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    gap: 7px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f2efea;
    color: #5f6368;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999ca3;
    flex: 0 0 auto;
}

.status-badge.connected .status-dot {
    background: #16823a;
    box-shadow: 0 0 0 4px rgba(22, 130, 58, 0.12);
}

.status-badge.error .status-dot {
    background: #be123c;
    box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.12);
}

.market-title {
    color: #131416;
    font-size: clamp(32px, 4.8vw, 52px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.market-description {
    max-width: 520px;
    color: #4f5257;
    font-size: 14px;
    line-height: 1.5;
}

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

.stat-item {
    min-height: 122px;
    padding: 12px;
    border: 1px solid rgba(19, 20, 22, 0.07);
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.stat-label {
    color: #6b6f76;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
    text-transform: uppercase;
}

.stat-value {
    color: #131416;
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.stat-change {
    font-size: 11px;
    font-weight: 800;
}

.dominance-bar {
    display: block;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #ece8e1;
}

.dominance-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fc6432;
    transition: width 600ms ease;
}

.highlights-section {
    margin-bottom: 14px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 9px;
}

.section-title {
    color: #131416;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.section-subtitle {
    color: #6b6f76;
    font-size: 12px;
    line-height: 1.35;
}

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.highlight-card {
    min-width: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.highlight-header {
    display: flex;
    align-items: center;
    gap: 9px;
}

.highlight-header i {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f2efea;
    color: #fc6432;
    flex: 0 0 auto;
    font-size: 13px;
}

.highlight-title {
    color: #131416;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15;
}

.highlight-subtitle {
    color: #74777f;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.coin-mini-list {
    display: grid;
    gap: 7px;
}

.mini-coin-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 160ms ease;
}

.mini-coin-row:hover {
    background: #f6f4ef;
}

.mini-coin-left {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.mini-coin-left img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(19, 20, 22, 0.08);
    flex: 0 0 auto;
}

.mini-coin-info {
    min-width: 0;
}

.mini-coin-sym {
    color: #131416;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    text-transform: uppercase;
}

.mini-coin-name,
.mini-coin-price {
    color: #74777f;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-coin-right {
    text-align: right;
}

.mini-coin-pct {
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.mini-error {
    padding: 10px 0;
    color: #74777f;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.skeleton-item {
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(90deg, #efede8, #f8f6f2, #efede8);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.2s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

.market-tools {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    margin-bottom: 9px;
}

.search-box {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid rgba(19, 20, 22, 0.1);
    border-radius: 8px;
    background: #ffffff;
}

.search-box:focus-within {
    border-color: #fc6432;
    box-shadow: 0 0 0 3px rgba(252, 100, 50, 0.11);
}

.search-icon {
    color: #74777f;
    font-size: 13px;
    flex: 0 0 auto;
}

.search-input {
    width: 100%;
    height: 42px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: #131416;
    font-size: 14px;
}

.search-input:focus {
    border: 0;
    box-shadow: none;
}

.search-clear {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #74777f;
}

.search-clear:hover {
    background: #f6f4ef;
    color: #131416;
}

.filter-chips {
    display: flex;
    gap: 7px;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid rgba(19, 20, 22, 0.1);
    border-radius: 8px;
    background: #ffffff;
    color: #4f5257;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: rgba(252, 100, 50, 0.42);
    color: #fc6432;
}

.filter-chip.active {
    border-color: #131416;
    background: #131416;
    color: #ffffff;
}

.api-note {
    margin: 0 0 14px;
    padding: 9px 12px;
    color: #6b6f76;
    font-size: 12px;
    line-height: 1.4;
}

.table-section {
    margin-bottom: 28px;
}

.table-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.table-title {
    color: #131416;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.table-meta {
    color: #74777f;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.crypto-table {
    min-width: 650px;
}

.table-head,
.crypto-row {
    display: grid;
    grid-template-columns: 52px minmax(180px, 1.6fr) minmax(130px, 1fr) 82px 82px 82px;
    align-items: center;
}

.table-head {
    position: sticky;
    top: 0;
    z-index: 3;
    min-height: 40px;
    padding: 0 12px;
    border-bottom: 1px solid rgba(19, 20, 22, 0.08);
    background: #f6f4ef;
}

.th {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    height: 40px;
    border: 0;
    background: transparent;
    color: #74777f;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.th.sortable:hover {
    color: #fc6432;
}

.th i {
    font-size: 9px;
    opacity: 0.58;
}

.th-rank {
    justify-content: center;
}

.th-coin {
    justify-content: flex-start;
}

.th-price,
.th-change {
    justify-content: flex-end;
}

.crypto-row {
    min-height: 56px;
    padding: 0 12px;
    border-bottom: 1px solid rgba(19, 20, 22, 0.07);
    background: #ffffff;
    cursor: pointer;
    transition: background 160ms ease;
}

.crypto-row:last-child {
    border-bottom: 0;
}

.crypto-row:hover {
    background: #f9f7f3;
}

.row-rank {
    color: #74777f;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.row-coin {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.row-coin img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(19, 20, 22, 0.08);
    flex: 0 0 auto;
}

.coin-info {
    min-width: 0;
}

.coin-symbol {
    display: block;
    color: #131416;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
}

.coin-name {
    display: block;
    color: #74777f;
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-price,
.row-change {
    text-align: right;
    font-size: 12px;
    font-weight: 800;
}

.row-price {
    color: #131416;
}

.loading-state,
.empty-state {
    display: flex;
    min-height: 220px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #74777f;
    text-align: center;
    font-size: 13px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e7e2da;
    border-top-color: #fc6432;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.pagination-btn {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(19, 20, 22, 0.1);
    border-radius: 8px;
    background: #ffffff;
    color: #131416;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #fc6432;
    color: #fc6432;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-dot {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: #d9d6d0;
    cursor: pointer;
    transition: width 160ms ease, background 160ms ease;
}

.page-dot.active {
    width: 24px;
    background: #fc6432;
}

.footer-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: #74777f;
    font-size: 11px;
}

.footer-attribution {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-attribution a {
    display: inline-flex;
    align-items: center;
}

.cg-logo {
    height: 20px;
    opacity: 0.72;
}

.footer-copyright {
    color: #74777f;
    font-size: 11px;
}

@media (min-width: 640px) {
    .crypto-wrapper {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (min-width: 1024px) {
    .crypto-wrapper {
        padding-left: 32px;
        padding-right: 32px;
    }
}

@media (max-width: 1023px) {
    .market-hero {
        grid-template-columns: 1fr;
    }

    .market-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .stat-item {
        min-height: 82px;
    }

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

@media (max-width: 760px) {
    .crypto-wrapper {
        padding-top: 58px;
    }

    .market-hero {
        gap: 8px;
        padding: 12px 0 10px;
    }

    .market-hero__copy {
        min-height: 118px;
        padding: 14px;
    }

    .market-title {
        font-size: 30px;
    }

    .market-description {
        font-size: 12px;
    }

    .market-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 8px;
    }

    .stat-item {
        min-height: 66px;
        padding: 9px;
    }

    .stat-label {
        font-size: 9px;
    }

    .stat-value {
        font-size: 16px;
    }

    .highlights-section {
        margin-bottom: 10px;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
        margin-bottom: 7px;
    }

    .highlights-grid {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .highlights-grid::-webkit-scrollbar {
        display: none;
    }

    .highlight-card {
        min-width: 250px;
        padding: 10px;
    }

    .market-tools {
        padding: 8px;
        margin-bottom: 8px;
    }

    .filter-chip {
        min-height: 34px;
        padding: 0 10px;
        font-size: 11px;
    }

    .api-note {
        margin-bottom: 10px;
        padding: 8px 10px;
    }

    .table-header-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .crypto-table {
        min-width: 610px;
    }

    .crypto-row {
        min-height: 52px;
    }

    .footer-container {
        align-items: flex-start;
        flex-direction: column;
    }
}

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