*, *::before, *::after {
    box-sizing: border-box; margin: 0; padding: 0;
}
:root {
    --bg: #0b0d15; --surface: #12161e; --surface-2: #1a1f2b;
    --border: #1e2533; --text: #e2e6ee; --text-secondary: #8a92a6;
    --green: #22c57a; --red: #f25a5f;
    --accent: #6366f1; --accent-dim: #4346c0;
    --gold: #f5b342; --silver: #a0a7b8; --bronze: #c97d4a;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
}
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.header { padding: 32px 0 20px; border-bottom: 1px solid var(--border); }
.header-top { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.logo { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.logo-dot { color: var(--accent); }
.badge { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.tagline { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 12px; }
.header-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.8rem; color: var(--text-secondary); }
.meta-item.green { color: var(--green); }
.meta-item.red { color: var(--red); }
.meta-item.green { color: var(--green); }
.meta-item.red { color: var(--red); }
.refresh-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}
.refresh-btn:hover { opacity: 0.85; }
.refresh-btn:disabled { opacity: 0.5; cursor: wait; }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-2);
    color: var(--text);
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    z-index: 100;
    transition: opacity 0.3s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; }

.rankings { padding: 20px 0; }
.table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 12px 16px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.col-rank { width: 40px; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--text-secondary); }
.rank-1 { background: var(--gold); color: #000; }
.rank-2 { background: var(--silver); color: #000; }
.rank-3 { background: var(--bronze); color: #fff; }
.col-coin { min-width: 160px; display: flex; align-items: center; gap: 10px; }
.coin-icon { border-radius: 50%; flex-shrink: 0; }
.coin-info { display: flex; flex-direction: column; }
.coin-name { font-weight: 600; font-size: 0.9rem; }
.coin-symbol { font-size: 0.75rem; color: var(--text-secondary); }
.col-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.change { font-weight: 600; font-variant-numeric: tabular-nums; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.col-score { min-width: 120px; }
.score-bar-container { width: 80px; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.score-bar { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); border-radius: 4px; transition: width 0.3s ease; }
.score-value { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.col-breakdown { min-width: 120px; }
.col-sparkle { min-width: 90px; text-align: center; }
.sparkline { display: inline-block; vertical-align: middle; }
.sparkline polyline { vector-effect: non-scaling-stroke; }

.breakdown { display: flex; gap: 12px; }
.bd-item { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; }
.bd-label { color: var(--text-secondary); font-weight: 600; }
.bd-val { font-variant-numeric: tabular-nums; color: var(--text); }
.empty { text-align: center; padding: 40px 16px !important; color: var(--text-secondary); }
.legend { padding: 32px 0; border-top: 1px solid var(--border); }
.legend h3 { font-size: 0.95rem; margin-bottom: 16px; color: var(--text); }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.legend-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.legend-card h4 { font-size: 0.85rem; margin-bottom: 6px; }
.legend-card p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.footer { padding: 20px 0 32px; text-align: center; font-size: 0.8rem; color: var(--text-secondary); border-top: 1px solid var(--border); }
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
@media (max-width: 700px) { .col-breakdown { display: none; } .col-score { min-width: 80px; } .score-bar-container { width: 50px; } thead th, tbody td { padding: 8px 10px; } html { font-size: 14px; } }
@media (max-width: 480px) { .col-change { display: none; } .col-breakdown { display: none; } .col-sparkle { display: none; } }

/* Token page */
.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 0;
}
.back-link:hover { opacity: 0.8; }
.token-header { font-size: 1.4rem; }
.coin-icon-lg { border-radius: 50%; vertical-align: middle; margin-right: 6px; }

.token-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 20px 0;
}
.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.info-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.info-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.info-value.positive { color: var(--green); }
.info-value.negative { color: var(--red); }

.breakdown-section, .chart-section {
    padding: 20px 0;
    border-top: 1px solid var(--border);
}
.breakdown-section h3, .chart-section h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: var(--text);
}

.breakdown-bars { display: flex; flex-direction: column; gap: 12px; }
.bar-item { display: flex; align-items: center; gap: 12px; }
.bar-label { font-size: 0.8rem; color: var(--text-secondary); width: 100px; flex-shrink: 0; }
.bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.bar-fill.accent { background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.bar-fill.green { background: linear-gradient(90deg, #1a8a5a, var(--green)); }
.bar-fill.cyan { background: linear-gradient(90deg, #0d8a9a, #2dd4bf); }
.bar-value { font-size: 0.8rem; font-weight: 600; width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

.chart-wrapper { height: 320px; padding: 12px 0; }
.no-data { text-align: center; color: var(--text-secondary); padding: 40px 0; font-size: 0.85rem; }
.not-found { text-align: center; padding: 60px 0; }
.not-found h2 { font-size: 1.2rem; margin-bottom: 8px; }
.not-found p { color: var(--text-secondary); margin-bottom: 20px; }

.coin-name {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}
.coin-name:hover { color: var(--accent); }
.bar-fill.accent { background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.bar-fill.green { background: linear-gradient(90deg, #1a8a5a, var(--green)); }
.bar-fill.cyan { background: linear-gradient(90deg, #0d8a9a, #2dd4bf); }
.bar-fill.orange { background: linear-gradient(90deg, #c97d4a, var(--bronze)); }

.bar-fill.red { background: linear-gradient(90deg, #dc2626, var(--red)); }
.bar-fill.red { background: linear-gradient(90deg, #dc2626, var(--red)); }.bar-fill.pink { background: linear-gradient(90deg, #a21caf, #d946ef); }
