/* ============================================
   Kernel Pro — Download Tools v2
   ============================================ */

:root {
    --bg-base:      #0c0d12;
    --bg-elevated:  #13141c;
    --bg-card:      #181924;
    --bg-card-hover:#1e2030;
    --bg-input:     #1a1b26;
    --text-primary:   #e4e6ed;
    --text-secondary: #8b8fa4;
    --text-muted:     #555871;
    --border:       #222436;
    --border-hover: #2e3148;
    --accent:       #4f7cff;
    --accent-dim:   rgba(79,124,255,0.12);
    --accent-hover: #3d6af0;
    --green:  #34d399;
    --red:    #f87171;
    --amber:  #fbbf24;
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-pill: 100px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
    --shadow-float: 0 8px 32px rgba(0,0,0,0.5);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 14px;
    letter-spacing: -0.011em;
}

/* ───── Top bar ───── */

.top {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.top-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.top-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    object-fit: cover;
}
.top h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.top .sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ───── Main ───── */

.main {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ───── Stats ───── */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow-card);
}
.stat .n {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}
.stat .l {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ───── Chart ───── */

.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}
.chart-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.chart-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.chart-body {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-base);
    padding: 4px;
}
.chart-body canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
}

/* ───── Search ───── */

.search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.15s;
}
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--text-muted); }

.search button {
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.search button:hover { background: var(--accent-hover); }

.search .btn-clear {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.search .btn-clear:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

/* ───── File list ───── */

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: border-color 0.15s, background 0.15s;
}
.file-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.file-info { flex: 1; min-width: 0; }
.file-name {
    font-size: 13px;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.file-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    gap: 12px;
}

.dl-btn {
    flex-shrink: 0;
    padding: 7px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.dl-btn:hover { background: var(--accent-hover); }
.dl-btn:active { transform: scale(0.96); }

.empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 13px;
}

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

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .file-card { flex-wrap: wrap; }
    .dl-btn { width: 100%; text-align: center; }
    .bars { height: 60px; }
}
@media (min-width: 769px) {
    .main { padding: 24px 20px 60px; }
    .bars { height: 100px; }
    .stat .n { font-size: 24px; }
}
