* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e14;
    --bg-secondary: #141922;
    --bg-tertiary: #1a1f2b;
    --border-color: #2a3441;
    --text-primary: #e6edf3;
    --text-secondary: #8b95a8;
    --text-tertiary: #636e7c;
    --accent-blue: #58a6ff;
    --accent-cyan: #39d0d8;
    --positive: #3fb950;
    --negative: #f85149;
    --warning: #d29922;
}

body {
    font-family: 'SUIT Variable', 'SUIT', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #050810 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Top Bar */
.top-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-tertiary);
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-item span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-bar-label {
    color: var(--text-tertiary);
}

.top-bar-value {
    color: var(--text-secondary);
    font-weight: 500;
}

.online-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--positive);
    border-radius: 50%;
    margin-right: 4px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Header */
.header {
    padding: 32px 0 24px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Market Overview */
.market-overview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.market-card {
    /*background: var(--bg-secondary);*/
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.market-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-tertiary);
    transform: translateY(-2px);
}

.market-name {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.market-price {
    font-size: 18px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
}

.market-change {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.market-change.positive {
    color: var(--positive);
}

.market-change.negative {
    color: var(--negative);
}

/* Controls */
.controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    /*background: var(--bg-secondary);*/
    /*border: 1px solid var(--border-color);*/
    border-radius: 8px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
}

.select-group {
    display: flex;
    gap: 6px;
}

select {
    background: linear-gradient(180deg, var(--bg-primary) 0%, #050810 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b95a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

select:hover {
    border-color: var(--accent-blue);
    background-color: var(--bg-secondary);
}

select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(57, 208, 216, 0.1);
}

.exchange-selector {
    position: relative;
    display: flex;
    align-items: center;
}

.exchange-selector .exchange-icon {
    position: absolute;
    left: 10px;
    z-index: 1;
    pointer-events: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.exchange-selector .exchange-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.exchange-selector select {
    padding-left: 40px;
}

.search-input {
    background: linear-gradient(180deg, var(--bg-primary) 0%, #050810 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-family: inherit;
    width: 200px;
    transition: all 0.2s ease;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(57, 208, 216, 0.1);
    width: 280px;
}

/* Table */
.table-container {
    /*background: var(--bg-secondary);*/
    /*border: 1px solid var(--border-color);*/
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th:nth-child(1), td:nth-child(1) {
    width: 210px;
}

th:nth-child(2), td:nth-child(2) {
    width: 180px;
}

th:nth-child(3), td:nth-child(3) {
    width: auto;
}

th:nth-child(4), td:nth-child(4) {
    width: auto;
}

th:nth-child(5), td:nth-child(5) {
    width: auto;
}

th:nth-child(6), td:nth-child(6) {
    width: auto;
}

th:nth-child(7), td:nth-child(7) {
    width: auto;
}

thead {
    /*background: var(--bg-tertiary);*/
    /*border-bottom: 1px solid var(--border-color);*/
}

th {
    padding: 14px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
th:nth-child(5),
th:nth-child(6),
th:nth-child(7) {
    text-align: right;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

td {
    padding: 20px 16px;
    font-size: 14px;
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7) {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.coin-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.coin-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.coin-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.coin-icon span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.coin-icon.btc {
    background: linear-gradient(135deg, #f7931a 0%, #f2a900 100%);
    color: #fff;
}

.coin-icon.eth {
    background: linear-gradient(135deg, #627eea 0%, #8a9cff 100%);
    color: #fff;
}

.coin-icon.xrp {
    background: linear-gradient(135deg, #23292f 0%, #3c444b 100%);
    color: #fff;
}

.coin-icon.sol {
    background: linear-gradient(135deg, #9945ff 0%, #14f195 100%);
    color: #fff;
}

.coin-icon.doge {
    background: linear-gradient(135deg, #c3a634 0%, #d4af37 100%);
    color: #fff;
}

.coin-icon.ada {
    background: linear-gradient(135deg, #0033ad 0%, #0d47a1 100%);
    color: #fff;
}

.coin-icon.dot {
    background: linear-gradient(135deg, #e6007a 0%, #ff4d9f 100%);
    color: #fff;
}

.coin-icon.link {
    background: linear-gradient(135deg, #2a5ada 0%, #3667e9 100%);
    color: #fff;
}

.coin-symbol {
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 400;
}

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.price-krw {
    font-size: 14px;
}

.price-usd {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 400;
}

.exchange-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    flex-shrink: 0;
}

.exchange-icon.upbit {
    background: linear-gradient(135deg, #0047d3 0%, #0066ff 100%);
    color: #fff;
}

.exchange-icon.bithumb {
    background: linear-gradient(135deg, #ed1c24 0%, #ff3838 100%);
    color: #fff;
}

.exchange-icon.binance {
    background: linear-gradient(135deg, #f3ba2f 0%, #f8d33a 100%);
    color: #000;
}

.exchange-icon.coinbase {
    background: linear-gradient(135deg, #0052ff 0%, #0066ff 100%);
    color: #fff;
}

.exchange-icon.htx {
    background: linear-gradient(135deg, #2ebd85 0%, #3dd99a 100%);
    color: #fff;
}

.exchange-icon.mexc {
    background: linear-gradient(135deg, #00c087 0%, #00d99a 100%);
    color: #fff;
}

.exchange-icon.okx {
    background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
    color: #fff;
}

.exchange-icon.bitget {
    background: linear-gradient(135deg, #00c9ff 0%, #00e5ff 100%);
    color: #fff;
}

.premium-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.premium-badge.high {
    background: rgba(63, 185, 80, 0.15);
    color: var(--positive);
}

.premium-badge.low {
    background: rgba(248, 81, 73, 0.15);
    color: var(--negative);
}

.premium-badge.neutral {
    background: rgba(139, 149, 168, 0.15);
    color: var(--text-secondary);
}

.change-positive {
    color: var(--positive);
}

.change-negative {
    color: var(--negative);
}

.volume {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    margin-top: 40px;
    padding: 24px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    th:nth-child(1), td:nth-child(1) {
        width: 25px;
    }

    .top-bar {
        font-size: 10px;
    }

    .top-bar-content {
        flex-wrap: wrap;
        gap: 8px;
    }

    .top-bar-item {
        gap: 12px;
    }

    .header {
        padding: 24px 0 20px;
    }

    .logo {
        font-size: 24px;
    }

    .subtitle {
        font-size: 12px;
    }

    /* Market Overview - 2 columns on mobile */
    .market-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .market-card {
        padding: 12px 14px;
    }

    .market-name {
        font-size: 10px;
    }

    .market-price {
        font-size: 16px;
    }

    .market-change {
        font-size: 11px;
    }

    /* Controls - Wrap to show search below */
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px;
    }

    .control-group {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex: 0 0 auto;
    }

    .control-label {
        font-size: 10px;
        white-space: nowrap;
    }

    .exchange-selector {
        position: relative;
        display: flex;
        align-items: center;
    }

    .exchange-icon {
        width: 16px;
        height: 16px;
        font-size: 8px;
        position: absolute;
        left: 8px;
        pointer-events: none;
    }

    .exchange-icon img {
        width: 16px;
        height: 16px;
        object-fit: contain;
        border-radius: 3px;
        display: block;
    }

    select {
        width: auto;
        min-width: 100px;
        font-size: 11px;
        padding: 8px 28px 8px 32px;
        background-position: right 8px center;
    }

    .search-input {
        width: 100%;
        font-size: 12px;
        padding: 8px 12px;
        flex: 1 1 100%;
    }

    /* Table - Hide 52-week columns */
    table {
        font-size: 13px;
    }

    th {
        padding: 12px 6px;
        font-size: 10px;
    }

    td {
        padding: 14px 6px;
        font-size: 13px;
    }

    /* Prevent wrapping in coin name column */
    td:first-child {
        white-space: nowrap;
        padding-left: 8px;
    }

    /* Make volume column narrower */
    td:last-child {
        font-size: 11px;
        padding-right: 8px;
    }

    /* Reduce font size for change columns */
    td:nth-child(4) {
        font-size: 11px;
    }

    /* Hide 52-week high/low columns */
    th:nth-child(5),
    th:nth-child(6),
    td:nth-child(5),
    td:nth-child(6) {
        display: none;
    }

    .coin-icon {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }

    .coin-name {
        gap: 6px;
        font-size: 13px;
        white-space: nowrap;
    }

    .coin-symbol {
        font-size: 11px;
    }

    .price-container {
        gap: 1px;
    }

    .price-krw {
        font-size: 12px;
    }

    .price-usd {
        font-size: 9px;
    }

    .premium-badge {
        font-size: 11px;
        padding: 3px 6px;
    }

    .volume {
        font-size: 11px;
    }

    .footer {
        margin-top: 32px;
        padding: 20px 0;
        font-size: 11px;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    .top-bar-content {
        font-size: 9px;
    }

    .logo {
        font-size: 20px;
    }

    .subtitle {
        font-size: 11px;
    }

    .market-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .market-card {
        padding: 10px 12px;
    }

    .market-price {
        font-size: 14px;
    }

    .controls {
        gap: 6px;
        padding: 10px;
    }

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

    .exchange-icon {
        width: 14px;
        height: 14px;
        font-size: 7px;
        left: 7px;
    }

    .exchange-icon img {
        width: 14px;
        height: 14px;
        object-fit: contain;
        border-radius: 3px;
        display: block;
    }

    select {
        min-width: 90px;
        font-size: 10px;
        padding: 7px 24px 7px 28px;
        background-position: right 6px center;
    }

    .search-input {
        font-size: 11px;
        padding: 7px 10px;
    }

    th {
        padding: 10px 4px;
        font-size: 9px;
    }

    td {
        padding: 12px 4px;
        font-size: 11px;
    }

    td:first-child {
        padding-left: 6px;
    }

    td:last-child {
        font-size: 10px;
        padding-right: 6px;
    }

    td:nth-child(4) {
        font-size: 10px;
    }

    /* Hide 52-week high/low columns */
    th:nth-child(5),
    th:nth-child(6),
    td:nth-child(5),
    td:nth-child(6) {
        display: none;
    }

    .coin-icon {
        width: 18px;
        height: 18px;
        font-size: 8px;
    }

    .coin-name {
        font-size: 11px;
        white-space: nowrap;
        gap: 4px;
    }

    .coin-symbol {
        font-size: 9px;
    }

    .price-krw {
        font-size: 11px;
    }

    .price-usd {
        font-size: 8px;
    }

    .premium-badge {
        font-size: 10px;
        padding: 2px 5px;
    }
}

/* ── 정렬 가능한 헤더 ── */
.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}
.th-sortable:hover {
    color: var(--accent-cyan);
}
.th-sortable.th-active {
    color: var(--accent-cyan);
}
.sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.8;
    min-width: 10px;
}

/* 가격 변동 애니메이션 */
@keyframes priceFlashUp {
    0% { background-color: transparent; }
    50% { background-color: rgba(34, 197, 94, 0.2); }
    100% { background-color: transparent; }
}

@keyframes priceFlashDown {
    0% { background-color: transparent; }
    50% { background-color: rgba(239, 68, 68, 0.2); }
    100% { background-color: transparent; }
}

.price-up {
    animation: priceFlashUp 0.6s ease-in-out;
}

.price-down {
    animation: priceFlashDown 0.6s ease-in-out;
}

.premium-badge.price-up {
    animation: priceFlashUp 0.6s ease-in-out;
}

.premium-badge.price-down {
    animation: priceFlashDown 0.6s ease-in-out;
}

/* ══════════════════════════════════════
   Footer
══════════════════════════════════════ */
.footer {
    margin-top: 48px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
    padding-bottom: 28px;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    margin-bottom: 24px;
}

.footer-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-cyan);
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}

.footer-desc {
    font-size: 12.5px;
    color: var(--text-tertiary);
    line-height: 1.8;
}

.footer-email {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-email:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.footer-notice {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-tertiary);
    opacity: 0.6;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    font-size: 11px;
    color: var(--text-tertiary);
    opacity: 0.5;
    text-align: center;
    letter-spacing: 0.3px;
}

@media (max-width: 600px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}
