:root {
    --bg-color: #050505;
    --card-bg: #0a0a0a;
    --border-color: #1f1f1f;
    --text-main: #e0e0e0;
    --text-sub: #666;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* 导航 */
.nav-container { position: absolute; top: 20px; right: 20px; z-index: 10; }
.nav-link {
    display: flex; align-items: center; gap: 8px; color: #aaa; text-decoration: none;
    font-size: 13px; padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px; transition: all 0.2s ease; backdrop-filter: blur(5px);
}
.nav-link:hover { background-color: rgba(255, 255, 255, 0.15); color: #fff; }
.nav-link svg { width: 14px; height: 14px; stroke: currentColor; }

/* 头部 */
.header { text-align: center; margin-bottom: 25px; width: 100%; }
h2 { font-weight: 600; font-size: 28px; margin: 0; color: #fff; letter-spacing: 0.5px; }
.subtitle { color: var(--text-sub); font-size: 13px; margin-top: 8px; font-weight: 300; }

/* 主布局 */
.main-layout {
    display: grid; grid-template-columns: 3fr 1fr; gap: 20px;
    width: 100%; max-width: 1400px; align-items: start;
}

.chart-wrapper {
    position: relative; height: 600px;
    background-color: var(--card-bg); padding: 15px 20px;
    border-radius: 16px; border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* 侧边栏 */
.sidebar {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 20px; height: 600px; box-sizing: border-box;
    display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }

.input-group {
    display: flex; gap: 10px; margin-bottom: 15px; align-items: center;
    background: #111; padding: 8px; border-radius: 8px; border: 1px solid #333;
}
.power-input {
    background: transparent; border: none; color: #fff; font-size: 16px;
    font-weight: bold; width: 60px; text-align: center; font-family: inherit;
}
.power-input:focus { outline: none; }
.unit-label { color: var(--text-sub); font-size: 12px; }

.rank-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 5px; }
.rank-list::-webkit-scrollbar { width: 4px; }
.rank-list::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.rank-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px; background-color: #111; border-radius: 6px;
    border-left: 3px solid transparent; transition: background 0.2s;
}
.rank-item:hover { background-color: #1a1a1a; }
.rank-info { display: flex; flex-direction: column; }
.rank-name { font-size: 12px; color: #ccc; font-weight: 500; }
.rank-ppw { font-size: 10px; color: var(--text-sub); margin-top: 2px; }
.rank-right { text-align: right; }
.rank-score { font-size: 14px; color: #fff; font-weight: 700; font-family: monospace; }
.rank-cap { font-size: 10px; font-weight: bold; margin-top: 2px; display: none; white-space: nowrap; }
.rank-item.capped-max .rank-cap { display: block; color: #ff5252; }
.rank-item.capped-min .rank-cap { display: block; color: #00e5ff; }

/* 底部区域 */
.bottom-section { width: 100%; max-width: 1400px; margin-top: 20px; }
.control-container { display: flex; justify-content: flex-start; margin-bottom: 10px; }

.toggle-btn {
    background-color: #1a1a1a; color: #ccc; border: 1px solid #333;
    padding: 8px 20px; border-radius: 20px; font-size: 12px; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.toggle-btn:hover { background-color: #333; color: #fff; }

/* 图例 */
#customLegend { display: flex; flex-direction: column; gap: 20px; }
.manufacturer-title { font-size: 14px; color: #888; border-left: 4px solid #444; padding-left: 10px; margin-bottom: 12px; font-weight: 700; }
.manufacturer-title[data-type="Qualcomm"] { border-color: #FFC107; color: #ffe082; }
.manufacturer-title[data-type="Qualcomm_UV"] { border-color: #00BCD4; color: #80DEEA; }
.manufacturer-title[data-type="MediaTek"] { border-color: #3F51B5; color: #7986cb; }
.manufacturer-title[data-type="MediaTek_UV"] { border-color: #9C27B0; color: #CE93D8; }
.manufacturer-title[data-type="Apple"] { border-color: #E0E0E0; color: #F5F5F5; }

.legend-items { display: flex; flex-wrap: wrap; gap: 10px; }
.legend-item { display: flex; flex-direction: column; padding: 8px 12px; background-color: #111; border: 1px solid #222; border-radius: 6px; cursor: pointer; min-width: 100px; }
.legend-item.hidden { opacity: 0.4; background-color: #0a0a0a; border-color: #1a1a1a; }
.legend-header { display: flex; align-items: center; margin-bottom: 2px; }
.legend-color-box { width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.legend-text { font-size: 13px; font-weight: 500; color: #eee; }
.legend-range { font-size: 11px; color: var(--text-sub); margin-left: 18px; }

.footer-info { margin-top: 40px; color: var(--text-sub); font-size: 12px; text-align: center; }

@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .sidebar { height: auto; min-height: 300px; }
    .chart-wrapper { height: 400px; }
}