:root {
--bg: #12161a; --card: #1a1e24; --border: #2a2e34; --accent: #00d4ff;
--green: #00ff9d; --warn: #ff4757; --yellow: #ffa502; --muted: #b8c6d4;
--text: #ffffff; --text2: #e2e8f0; --btn-bg: #22262c;
--hero-bg: linear-gradient(145deg, #2a2e34, #1a1e24);
--sec-bg: #1a1e24; --card-bg: #262b32; --overlay-bg: rgba(26,30,36,0.92);
--mono: 'Share Tech Mono', monospace; --sans: 'Noto Sans SC', sans-serif;
--status-ok: var(--green); --status-offline: var(--warn); --info: #3b82f6;
}
html.light-mode {
--bg: #f4f5f7; --card: #ffffff; --border: #d1d9e0; --accent: #0066ff;
--green: #2ecc71; --warn: #e74c3c; --yellow: #f39c12; --muted: #8792a2;
--text: #1a1f36; --text2: #697386; --btn-bg: #eef1f6;
--hero-bg: linear-gradient(145deg, #6090e8, #2e59ba);
--sec-bg: #ffffff; --card-bg: #f7f9fc; --overlay-bg: rgba(255,255,255,0.96);
}
html.light-mode .panel-title { text-shadow: 0 0 6px rgba(0, 102, 255, 0.15); }
html.light-mode .data-value { text-shadow: 0 0 4px rgba(46, 204, 113, 0.1); }
html.light-mode .bms-panel::before {
background: conic-gradient(from 0deg, transparent, rgba(0, 102, 255, 0.08), transparent 30%);
}
html.light-mode .bms-panel:hover { box-shadow: 0 10px 30px rgba(0, 102, 255, 0.05), 0 0 20px rgba(46, 204, 113, 0.03); }
html.light-mode .refresh-btn:hover { box-shadow: 0 0 10px rgba(0, 102, 255, 0.2); }
html.light-mode .bt-btn:hover { box-shadow: 0 0 10px rgba(0, 102, 255, 0.08); }
html.light-mode .data-row::after {
background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.02), transparent);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body, html { width: 100%; height: 100%; height: 100dvh; font-family: var(--sans); background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; -webkit-overflow-scrolling: auto; transition: background 0.3s, color 0.3s; }
body { animation: mainFadeIn 0.35s ease-out; }
@keyframes mainFadeIn { from { opacity: 0; } to { opacity: 1; } }
#top-bar {
position: absolute; top: 0; left: 0; right: 0; height: 38px;
background: rgba(26, 30, 36, 0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255,255,255,0.06);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
display: flex; justify-content: space-between; align-items: center; padding: 0 15px; z-index: 300;
transition: background 0.3s, border-color 0.3s;
}
html.light-mode #top-bar {
background: rgba(255, 255, 255, 0.85);
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.dev-state {
width: auto; min-width: 75px; height: 36px; border-radius: 10px; display: flex; align-items: center; gap: 5px; padding: 0 8px;
background: transparent;
cursor: pointer; position: relative;
box-shadow: none;
transition: all 0.3s ease;
}
.dev-state:hover {
box-shadow: none;
transform: scale(1.03);
}
.dev-heart {
font-size: 28px; line-height: 1; flex-shrink: 0;
color: #f87171; text-shadow: 0 0 6px rgba(248,113,113,0.6);
transition: color 0.3s, text-shadow 0.3s;
display: inline-block; font-weight: 900;
}
.dev-state.online .dev-heart {
color: #ef4444;
text-shadow: 0 0 6px rgba(239,68,68,0.7);
animation: heartBeat 1.2s ease-in-out infinite;
}
.dev-state.offline .dev-heart {
color: #a855f7;
text-shadow: 0 0 8px rgba(168,85,247,0.7);
}
@keyframes heartBeat {
0%, 100% { transform: scale(1); }
15% { transform: scale(1.15); }
30% { transform: scale(1); }
45% { transform: scale(1.1); }
60% { transform: scale(1); }
}
.dev-info {
display: flex; align-items: center; gap: 4px; line-height: 1;
}
.dev-uptime {
font-size: 16px; font-weight: 600; color: var(--text);
white-space: nowrap; letter-spacing: 0;
}
.dev-soc {
font-size: 16px; font-weight: 700; color: var(--accent);
white-space: nowrap;
}
@keyframes devOfflinePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.dev-state.offline { animation: devOfflinePulse 2s ease-in-out infinite; }

/* WiFi和蓝牙状态图标 */
.conn-icons {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 6px;
    padding-left: 6px;
    border-left: 1px solid rgba(255,255,255,0.08);
}
html.light-mode .conn-icons { border-left-color: rgba(0,0,0,0.08); }

.conn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
}
html.light-mode .conn-icon { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.06); }

.conn-icon svg {
    width: 14px;
    height: 14px;
}

/* WiFi图标颜色 */
.conn-icon.wifi svg { stroke: #00d4ff; }
.conn-icon.wifi.disconnected svg { stroke: #555; }

/* 蓝牙图标颜色 */
.conn-icon.ble svg { stroke: #fbbf24; }
.conn-icon.ble.disconnected svg { stroke: #555; }

/* 连接状态小圆点 - 已隐藏，改用图标颜色表示 */
.conn-icon .status-dot { display: none; }
.top-actions { display: flex; align-items: center; gap: 6px; }
#theme-toggle, .top-btn {
display: flex; align-items: center; gap: 4px; padding: 5px 10px;
border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
background: rgba(255,255,255,0.05); color: var(--text);
cursor: pointer; font-size: 12px; transition: all 0.2s;
}
#theme-toggle:hover, .top-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
#theme-toggle:active, .top-btn:active { transform: scale(0.96); }
.top-btn .btn-icon { font-size: 16px; }
.btn-svg { width: 16px; height: 16px; }
.top-btn .btn-text { font-size: 13px; }
#bottom-tab-bar {
position: absolute; bottom: 0; left: 0; right: 0; height: 40px;
padding-bottom: env(safe-area-inset-bottom);
background: rgba(26, 30, 36, 0.9);
backdrop-filter: blur(12px);
border-top: 1px solid rgba(255,255,255,0.06);
display: flex; align-items: stretch; z-index: 300;
transition: background 0.3s, border-color 0.3s;
}
html.light-mode #bottom-tab-bar {
background: rgba(255, 255, 255, 0.9);
border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.tab-btn {
flex: 1; background: none; border: none; border-top: 3px solid transparent;
color: var(--muted); font-family: var(--sans); font-size: 16px; font-weight: bold;
cursor: pointer; transition: color .2s, border-color .2s, transform .3s; letter-spacing: .5px; outline: none;
position: relative; overflow: visible;
display: flex; align-items: center; justify-content: center;
}
.tab-btn.active {
color: var(--accent); border-top-color: transparent;
transform: translateY(-3px) scale(1.08);
}
.tab-btn.active::before {
content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
width: 50%; height: 8px; border-radius: 4px;
background: linear-gradient(90deg, var(--green), var(--accent), #a78bfa, var(--accent), var(--green));
background-size: 300% 100%;
animation: tabShine 3s ease-in-out infinite;
box-shadow: 0 2px 15px rgba(0, 212, 255, 0.6), 0 0 25px rgba(0, 255, 157, 0.4), 0 0 8px rgba(167, 139, 250, 0.3);
}
.tab-btn.active::after {
content: ''; position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
width: 70%; height: 24px; border-radius: 12px;
background: radial-gradient(ellipse, rgba(0, 212, 255, 0.2), transparent 70%);
animation: tabGlow 2s ease-in-out infinite;
pointer-events: none;
}
@keyframes tabShine {
0%, 100% { background-position: 0% 50%; width: 50%; }
50% { background-position: 100% 50%; width: 70%; }
}
@keyframes tabGlow {
0%, 100% { opacity: 0.4; transform: translateX(-50%) scaleX(0.9); }
50% { opacity: 1; transform: translateX(-50%) scaleX(1.2); }
}
.tab-btn:hover:not(.active) { color: var(--text); transform: translateY(-1px); }
.tab-btn:active { transform: scale(0.95) !important; }
.page { position: absolute; top: 40px; left: 0; right: 0; bottom: calc(40px + env(safe-area-inset-bottom)); opacity: 0; pointer-events: none; z-index: 1; background: var(--bg); overscroll-behavior: none; overflow-y: auto; -webkit-overflow-scrolling: touch; transition: opacity 0.3s ease-in-out; }
.page.active { opacity: 1; pointer-events: auto; z-index: 2; }
#container, #track-container { width: 100%; height: 100%; z-index: 1; transition: filter 0.3s ease; }
.info-card { position: absolute; top: 8px; left: 8px; background: rgba(30, 38, 50, 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.3); z-index: 100; padding: 7px 10px; width: 220px; transition: background 0.3s, border-color 0.3s; }
.info-card, .info-card * { text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
html.light-mode .info-card, html.light-mode .info-card * { text-shadow: none; color: var(--text); }
html.light-mode .info-card { background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(0, 0, 0, 0.08); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: var(--text); }
html.light-mode .control-panel { background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(0, 0, 0, 0.08); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: var(--text); }
html.light-mode .control-panel * { color: var(--text); }
html.light-mode input[type="date"] { color: var(--text); background: var(--bg); border: 1px solid var(--border); }
.control-panel {
position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
background: rgba(30, 34, 40, 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255,255,255,0.06); padding: 15px;
border-radius: 6px; box-shadow: 0 -2px 15px rgba(0,0,0,0.2); z-index: 100;
display: flex; flex-wrap: wrap; gap: 10px; width: 90%; max-width: 600px;
transition: background 0.3s, border-color 0.3s;
}
.status-on { color: var(--green); font-weight: bold; font-size: 16px; } .status-off { color: var(--warn); font-weight: bold; } .status-connecting { color: var(--info, #3b82f6); font-weight: bold; }
html.light-mode .status-on { color: #27ae60; }
.info-row { margin: 1px 0; font-size: 12px; line-height: 1.3; }
.info-row-actions { display: flex; gap: 4px; margin: 3px 0; }
.info-row-actions button { flex: 1; padding: 4px 2px; font-size: 10px; text-align: center; white-space: nowrap; }
.speed-display { font-size: 18px; color: var(--accent); font-weight: bold; font-family: var(--mono); }
button:not(.tab-btn, #theme-toggle, .top-btn) {
padding: 5px 10px; border: 1px solid var(--border); border-radius: 4px;
background: var(--btn-bg); color: var(--text); cursor: pointer; font-size: 11px;
font-family: var(--sans); transition: background .15s, border-color .15s, color .3s, transform 0.1s;
}
button:not(.tab-btn, #theme-toggle, .top-btn):hover { background: var(--border); border-color: var(--accent); }
button:not(.tab-btn, #theme-toggle, .top-btn):active { transform: scale(0.96); }
button.danger { border-color: var(--warn); color: var(--warn); } button.danger:hover { background: rgba(231, 76, 60, 0.15); }
button:disabled { opacity: .4; cursor: not-allowed; }
input[type=number], input[type=date], select {
width: 70px; padding: 7px; border: 1px solid var(--border); border-radius: 4px;
background: var(--bg); color: var(--text); font-size: 12px; outline: none;
transition: background 0.3s, border-color 0.3s, color 0.3s;
}
#log-area { margin-top: 2px; font-size: 10px; color: var(--muted); max-height: 60px; overflow-y: auto; border-top: 1px solid var(--border); padding-top: 2px; font-family: var(--mono); }
#page-bms { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; background: var(--bg); padding-bottom: 25px; overscroll-behavior: none; }
.bms-layout { display: flex; flex-direction: column; gap: 12px; max-width: 960px; margin: 0 auto; padding-bottom: 16px; }
.bms-merged-section { max-width: 960px; margin: 0 auto; }
.bms-merged-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 600px) { .bms-merged-grid { grid-template-columns: 1fr; } }
.bms-panel {
position: relative;
background: rgba(30, 34, 40, 0.65); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255,255,255,0.06);
border-radius: 8px;
overflow: hidden;
transition: transform 0.3s, box-shadow 0.3s;
}
html.light-mode .bms-panel {
background: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(0, 0, 0, 0.08);
}
.bms-panel > * { position: relative; z-index: 1; }
.bms-panel:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0, 212, 255, 0.08), 0 0 40px rgba(0, 255, 157, 0.05); }
html.light-mode .bms-panel:hover { box-shadow: 0 10px 30px rgba(0, 102, 255, 0.05), 0 0 20px rgba(46, 204, 113, 0.03); }
.bms-panel.area-status { grid-area: status; } .bms-panel.area-control { grid-area: control; }
.bms-panel.area-cells { grid-area: cells; }
.bms-panel.bt-panel-plain { background: transparent; border: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.bms-panel.bt-panel-plain:hover { transform: none; box-shadow: none; }
html.light-mode .bms-panel.bt-panel-plain { background: transparent; border: none; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: rgba(0,0,0,0.05); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.bms-panel.bt-panel-plain .panel-header { padding: 6px 0; border-bottom: none; background: transparent; position: relative; }
html:not(.light-mode) .panel-header { background: rgba(18, 22, 26, 0.9); border-bottom: 1px solid rgba(0, 212, 255, 0.15); }
html:not(.light-mode) .bms-panel.bt-panel-plain .panel-header { background: transparent; border-bottom: none; }
html.light-mode .panel-header { border-bottom: 1px solid rgba(0, 102, 255, 0.12); }
.panel-title { font-size: 14px; font-weight: bold; color: var(--accent); display: flex; align-items: center; gap: 5px; text-shadow: 0 0 8px rgba(0, 212, 255, 0.5), 0 0 2px rgba(0, 212, 255, 0.8); }
html.light-mode .panel-title { color: #0066ff; text-shadow: 0 0 6px rgba(0, 102, 255, 0.25); }
.panel-meta { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-right: 6px; }
.refresh-btn { padding: 5px 12px; font-size: 11px; background: var(--accent); color: #fff; border: none; font-weight: 700; cursor: pointer; transition: opacity .15s, transform 0.3s; }
.refresh-btn:hover { opacity: .85; box-shadow: 0 0 15px rgba(0, 212, 255, 0.4); border-color: var(--accent); } .refresh-btn:disabled { opacity: .4; cursor: not-allowed; }
.refresh-btn:active { transform: rotate(360deg) scale(0.9); }
.panel-body { padding: 4px 10px; }
.data-row {
display: flex; justify-content: space-between; align-items: center; padding: 3px 0;
border-bottom: 1px solid var(--border); font-size: 12px; gap: 8px;
position: relative; overflow: hidden;
}
.data-row:last-child { border-bottom: none; }
.data-row::after {
content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.03), transparent);
transition: left 0.6s;
}
.data-row:hover::after { left: 100%; }
.data-label { color: var(--text2); white-space: nowrap; text-shadow: 0 0 3px rgba(255,255,255,0.1); }
.data-value { font-family: var(--mono); color: var(--text); text-align: right; text-shadow: 0 0 6px rgba(255,255,255,0.15); }
.data-value.good { color: var(--green); } .data-value.warn { color: var(--yellow); } .data-value.bad { color: var(--warn); }
/* 新布局：上排圆环+功率曲线，下排横向按钮 */
.bms-top-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin-bottom: 8px;
    width: 100%;
}

/* 上排：左圆圈 + 右功率曲线 并排 */
.bms-top-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

/* 左边 160x160 正方形方框（圆圈） */
.ring-box {
    width: 160px;
    height: 160px;
    background: var(--sec-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

/* 圆圈动画160x160（呼吸光环），填满160x160框 */
.ring-box .h-ring-svg {
    width: 160px !important;
    height: 160px !important;
}

.ring-box > .energy-waves,
.ring-box > .particle-layer {
    width: 160px;
    height: 160px;
}

/* 右侧：充放电功率曲线 */
.power-chart-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--sec-bg);
    border: 1px solid rgba(56,189,248,0.25);
    border-radius: 8px;
    padding: 8px;
    height: 160px;
    box-sizing: border-box;
}
.power-chart-side .power-chart-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: none;
    background: transparent;
}
.power-chart-side .power-chart-panel > div:nth-child(2) {
    flex: 1;
    min-height: 108px;
}

/* 功能按钮横向排列（下排） */
.buttons-box {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 8px;
    background: rgba(239,68,68,0.04);
}
.buttons-box .action-btn {
    padding: 10px 8px;
    font-size: 13px;
    gap: 6px;
    justify-content: center;
    border-radius: 6px;
}

/* 功率曲线下的按钮组 - 单独外框 */
.power-chart-side .btn-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 8px;
    background: rgba(239,68,68,0.04);
}
.power-chart-side .btn-stack .action-btn {
    padding: 8px 6px;
    font-size: 12px;
    gap: 6px;
    justify-content: center;
    border-radius: 6px;
}
.power-chart-side .btn-stack .action-btn svg {
    width: 18px;
    height: 18px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--sec-bg);
    color: #d0d0d0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--sans);
    border-left: 3px solid transparent;
}

.action-btn:hover {
    background: var(--card-bg);
    transform: translateX(2px);
}

.action-btn:active {
    transform: translateX(1px) scale(0.98);
}

.action-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.action-btn.btn-query { border-left-color: #00d4ff; }
.action-btn.btn-auto { border-left-color: #a78bfa; }
.action-btn.btn-auto[disabled] { opacity: 0.45; cursor: not-allowed; border-left-color: #555; color: #666; }
.action-btn.btn-auto[disabled] svg { stroke: #555; }
.action-btn.btn-auto[disabled]:hover { transform: none; background: transparent; }
.action-btn.btn-connect { border-left-color: #fbbf24; }
.action-btn.btn-disconnect { border-left-color: #ef4444; }

html.light-mode .action-btn { color: #333; }
html.light-mode .action-btn:hover { background: var(--card-bg); }

/* 桌面端优化：功率曲线下的按钮适配 */
@media (min-width: 768px) {
    .power-chart-side .btn-stack {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* 电芯网格布局 */
.cell-item { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 4px 2px; text-align: center; transition: border-color .3s, background 0.3s, transform 0.15s; }
html:not(.light-mode) .cell-item { background: rgba(18, 22, 26, 0.8); }
.cell-item:hover { transform: scale(1.05); }
.cell-num { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
html.light-mode .cell-num { color: #6b7280; }
.cell-val { font-family: var(--mono); font-size: 14px; color: var(--text); }
.cell-item.cell-high { border-color: var(--warn); background: rgba(231, 76, 60, 0.08); } .cell-item.cell-high .cell-val { color: var(--warn); }
.cell-item.cell-low { border-color: var(--yellow); background: rgba(243, 156, 18, 0.08); } .cell-item.cell-low .cell-val { color: var(--yellow); }
.cell-item.cell-ok { border-color: var(--green); } .cell-item.cell-ok .cell-val { color: var(--green); }
html:not(.light-mode) .cell-item.cell-ok { border-color: rgba(0, 255, 157, 0.15); }
.batt-cell-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; padding: 8px 10px; }
.batt-cell { display: flex; flex-direction: column; align-items: center; padding: 4px 2px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); transition: all 0.3s; cursor: pointer; }
html:not(.light-mode) .batt-cell { background: rgba(18, 22, 26, 0.8); }
html.light-mode .batt-cell { background: #e2e5e9; border-color: #c5c9d0; }
.batt-cell:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 4px 12px rgba(0, 212, 255, 0.15); }
.batt-cell.cell-high { border-color: var(--warn); box-shadow: 0 0 8px rgba(255, 71, 87, 0.2); }
.batt-cell.cell-low { border-color: var(--yellow); box-shadow: 0 0 8px rgba(255, 165, 2, 0.2); }
.batt-cell-num { font-size: 9px; color: var(--muted); margin-bottom: 2px; font-family: var(--mono); }
.batt-cell-svg { width: 28px; height: 40px; margin: 2px 0; }
.batt-cell-val { font-family: var(--mono); font-size: 10px; color: var(--text); margin-top: 2px; }
.alarm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; padding: 8px 14px 12px; }
@media (max-width: 420px) { .alarm-grid { grid-template-columns: 1fr; } }
.alarm-item { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; color: var(--muted); }
.alarm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background .3s; }
.alarm-item.fault .alarm-dot { background: var(--warn); box-shadow: 0 0 5px var(--warn); }
.alarm-item.fault { color: var(--warn); }
.panel-empty { text-align: center; padding: 24px 14px; color: var(--muted); font-size: 13px; font-family: var(--mono); }
.card-header { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: bold; color: var(--accent); cursor: pointer; margin-bottom: 3px; }
.toggle-icon { font-size: 16px; color: var(--muted); transition: transform 0.3s; }
.card-content { max-height: 500px; overflow: hidden; transition: max-height 0.3s ease; }
.card-content.collapsed { max-height: 0; opacity: 0; margin-top: -5px; pointer-events: none; }
#bms-view-premium { max-width: 960px; margin: 0 auto; padding: 0 10px 20px; }
.prem-hero-card { background: transparent; border-radius: 8px; padding: 0; position: relative; overflow: hidden; max-height: 45dvh; margin: 0 0 8px 0; border: none; transition: transform 0.2s, background 0.3s; }
html.light-mode .prem-hero-card {
    background: transparent;
    box-shadow: none;
    border: none;
}
html:not(.light-mode) .prem-hero-card { box-shadow: none; border: none; }
.prem-hero-card::after { display: none; }
.h-ring-container { display: flex; align-items: center; justify-content: center; gap: 0; padding: 0; width: 100%; }
.h-ring-wrap { position: relative; flex-shrink: 0; }
.h-ring-svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.h-ring-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 14; }
html.light-mode .h-ring-bg { stroke: rgba(0,0,0,0.06); }
.h-ring-fill { fill: none; stroke: url(#ringGrad); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1s ease-in-out; animation: ringPulse 3s ease-in-out infinite; }
.h-ring-glow { fill: none; stroke: url(#ringGlow); stroke-width: 22; stroke-linecap: round; opacity: 0.4; transition: stroke-dashoffset 1s ease-in-out; filter: blur(6px); }
.h-ring-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 3; }
.h-ring-pct { font-size: 40px; font-weight: bold; font-family: var(--mono); color: #fff; line-height: 1; text-shadow: 0 0 20px rgba(0, 212, 255, 0.6); }
html.light-mode .h-ring-pct { color: #000; text-shadow: none; }
.h-ring-label { font-size: 12px; color: #fff; margin-top: 2px; text-shadow: 0 0 8px rgba(0,0,0,0.3); }
html.light-mode .h-ring-label { color: #333; text-shadow: none; }
@keyframes ringPulse {
0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.4)); }
50% { filter: drop-shadow(0 0 14px rgba(0, 212, 255, 0.7)); }
}
.particle-layer { position: absolute; top: 0; left: 0; width: 200px; height: 200px; pointer-events: none; z-index: 1; overflow: hidden; --p-color: #00d4ff; }
.p-item { position: absolute; opacity: 0; will-change: transform, opacity; }
.p-halo { border-radius: 50%; border: 1.5px solid var(--p-color); background: transparent; box-shadow: 0 0 6px var(--p-color), inset 0 0 4px var(--p-color); animation: pHalo var(--p-dur, 3s) ease-in-out var(--p-delay, 0s) infinite; }
@keyframes pHalo { 0% { opacity: 0; transform: translate(0,0) scale(0.4); } 20% { opacity: var(--p-op, 0.8); transform: translate(calc(var(--p-dx,0)*0.3), calc(var(--p-dy,0)*0.3)) scale(1); } 70% { opacity: var(--p-op2, 0.3); } 100% { transform: translate(var(--p-dx,0), var(--p-dy,0)) scale(1.3); opacity: 0; } }
.p-lightning { width: 1.5px; border-radius: 1px; background: var(--p-color); box-shadow: 0 0 4px var(--p-color); animation: pLightning var(--p-dur, 2s) ease-in-out var(--p-delay, 0s) infinite; }
@keyframes pLightning { 0% { opacity: 0; transform: translate(0,0) scaleY(0.2); } 30% { opacity: var(--p-op, 0.9); transform: translate(calc(var(--p-dx,0)*0.3), calc(var(--p-dy,0)*0.3)) scaleY(1); } 65% { opacity: var(--p-op2, 0.4); } 100% { transform: translate(var(--p-dx,0), var(--p-dy,0)) scaleY(0.5); opacity: 0; } }
.p-beam { width: 2px; border-radius: 1px; background: linear-gradient(180deg, transparent 0%, var(--p-color) 40%, var(--p-color) 60%, transparent 100%); box-shadow: 0 0 4px var(--p-color); animation: pBeam var(--p-dur, 2.5s) ease-in-out var(--p-delay, 0s) infinite; }
@keyframes pBeam { 0% { opacity: 0; transform: translate(0,0) scaleY(0.3); } 30% { opacity: var(--p-op, 0.8); transform: translate(calc(var(--p-dx,0)*0.35), calc(var(--p-dy,0)*0.35)) scaleY(1); } 70% { opacity: var(--p-op2, 0.2); } 100% { transform: translate(var(--p-dx,0), var(--p-dy,0)) scaleY(0.4); opacity: 0; } }
.p-blink { border-radius: 50%; background: var(--p-color); box-shadow: 0 0 4px var(--p-color), 0 0 8px var(--p-color); animation: pBlink var(--p-dur, 1.8s) ease-in-out var(--p-delay, 0s) infinite; }
@keyframes pBlink { 0% { opacity: 0; transform: translate(0,0) scale(0.3); } 35% { opacity: var(--p-op, 1); transform: translate(calc(var(--p-dx,0)*0.3), calc(var(--p-dy,0)*0.3)) scale(1); } 75% { opacity: var(--p-op2, 0.3); } 100% { transform: translate(var(--p-dx,0), var(--p-dy,0)) scale(0.2); opacity: 0; } }
.p-star5 { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: var(--p-color); box-shadow: 0 0 4px var(--p-color); animation: pStar var(--p-dur, 3s) ease-in-out var(--p-delay, 0s) infinite; }
.p-star4 { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); background: var(--p-color); box-shadow: 0 0 4px var(--p-color); animation: pStar var(--p-dur, 2.5s) ease-in-out var(--p-delay, 0s) infinite; }
@keyframes pStar { 0% { opacity: 0; transform: translate(0,0) rotate(0deg) scale(0.3); } 30% { opacity: var(--p-op, 0.9); transform: translate(calc(var(--p-dx,0)*0.3), calc(var(--p-dy,0)*0.3)) rotate(var(--p-r,45deg)) scale(1); } 70% { opacity: var(--p-op2, 0.3); } 100% { transform: translate(var(--p-dx,0), var(--p-dy,0)) rotate(calc(var(--p-r,45deg) + 60deg)) scale(0.2); opacity: 0; } }
.p-radial { color: var(--p-color); animation: pRadial var(--p-dur, 2s) ease-in-out var(--p-delay, 0s) infinite; }
.p-radial::before, .p-radial::after { content: ''; position: absolute; background: var(--p-color); box-shadow: 0 0 3px var(--p-color); }
.p-radial::before { width: 100%; height: 1px; top: 50%; left: 0; transform: translateY(-50%); }
.p-radial::after { width: 1px; height: 100%; top: 0; left: 50%; transform: translateX(-50%); }
@keyframes pRadial { 0% { opacity: 0; transform: translate(0,0) scale(0.3) rotate(0deg); } 30% { opacity: var(--p-op, 0.8); transform: translate(calc(var(--p-dx,0)*0.3), calc(var(--p-dy,0)*0.3)) scale(1) rotate(var(--p-r,45deg)); } 70% { opacity: var(--p-op2, 0.3); } 100% { transform: translate(var(--p-dx,0), var(--p-dy,0)) scale(0.2) rotate(calc(var(--p-r,45deg) + 45deg)); opacity: 0; } }
/* 新增5种粒子形状 */
.p-triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); background: var(--p-color); box-shadow: 0 0 4px var(--p-color); animation: pStar var(--p-dur, 3s) ease-in-out var(--p-delay, 0s) infinite; }
.p-cross { position: relative; animation: pRadial var(--p-dur, 2.5s) ease-in-out var(--p-delay, 0s) infinite; }
.p-cross::before, .p-cross::after { content: ''; position: absolute; background: var(--p-color); box-shadow: 0 0 3px var(--p-color); }
.p-cross::before { width: 100%; height: 2px; top: 50%; left: 0; transform: translateY(-50%); }
.p-cross::after { width: 2px; height: 100%; top: 0; left: 50%; transform: translateX(-50%); }
.p-glow-orb { border-radius: 50%; background: radial-gradient(circle, var(--p-color) 0%, color-mix(in srgb, var(--p-color) 50%, transparent) 50%, transparent 80%); box-shadow: 0 0 6px var(--p-color); animation: pBlink var(--p-dur, 3s) ease-in-out var(--p-delay, 0s) infinite; }
.p-snowflake { clip-path: polygon(50% 0%, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0% 50%, 42% 42%); background: var(--p-color); box-shadow: 0 0 5px var(--p-color); animation: pStar var(--p-dur, 3.5s) ease-in-out var(--p-delay, 0s) infinite; }
.p-heart { clip-path: path('M50 90C20 60 0 40 0 25C0 10 15 0 30 0C40 0 48 5 50 12C52 5 60 0 70 0C85 0 100 10 100 25C100 40 80 60 50 90Z'); background: var(--p-color); box-shadow: 0 0 4px var(--p-color); animation: pStar var(--p-dur, 2.8s) ease-in-out var(--p-delay, 0s) infinite; }
html.light-mode .particle-layer { --p-color: #0088cc; }
.particle-layer.p-charging .p-item { animation-duration: calc(var(--p-dur, 3s) * 0.5) !important; }
.particle-layer.p-discharging .p-item { animation-duration: calc(var(--p-dur, 3s) * 1.3) !important; }
.low-battery .h-ring-svg { animation: lowBatteryPulse 1.2s ease-in-out infinite; }
.low-battery .h-ring-pct { animation: lowBatteryTextBlink 1.2s ease-in-out infinite; }
html.light-mode .low-battery .h-ring-pct { animation: lowBatteryTextBlinkLight 1.2s ease-in-out infinite; }
@keyframes lowBatteryPulse { 0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 71, 87, 0.5)); } 50% { filter: drop-shadow(0 0 22px rgba(255, 71, 87, 1)); } }
@keyframes lowBatteryTextBlink { 0%, 100% { color: #fff; text-shadow: 0 0 20px rgba(255, 71, 87, 0.5); } 50% { color: #ff4757; text-shadow: 0 0 28px rgba(255, 71, 87, 1); } }
@keyframes lowBatteryTextBlinkLight { 0%, 100% { color: #1a1f36; text-shadow: 0 0 8px rgba(231, 76, 60, 0.2); } 50% { color: #e74c3c; text-shadow: 0 0 16px rgba(231, 76, 60, 0.6); } }
.h-ring-dot { fill: #fff; filter: drop-shadow(0 0 6px var(--p-color, #00d4ff)) drop-shadow(0 0 14px var(--p-color, #00d4ff)); transition: opacity 0.3s; }
.energy-waves { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 180px; height: 180px; pointer-events: none; z-index: 0; }
.ewave { position: absolute; top: 50%; left: 50%; border-radius: 50%; border: 1.5px solid var(--p-color, #00d4ff); transform: translate(-50%, -50%); opacity: 0; animation: ewaveExpand 4s ease-out infinite; }
.ewave:nth-child(2) { animation-delay: 1.3s; }
.ewave:nth-child(3) { animation-delay: 2.6s; }
@keyframes ewaveExpand { 0% { width: 20px; height: 20px; opacity: 0.35; border-width: 2px; } 100% { width: 150px; height: 150px; opacity: 0; border-width: 0.5px; } }
.h-ring-wrap::after {
content: ''; position: absolute; top: 50%; left: 50%; width: 150px; height: 150px;
transform: translate(-50%, -50%); border-radius: 50%;
border: 2px solid var(--p-color, #00d4ff); opacity: 0;
animation: socBreath var(--breath-dur, 4s) ease-in-out infinite;
pointer-events: none; z-index: 0;
}
@keyframes socBreath {
0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.98); }
50% { opacity: 0.35; transform: translate(-50%, -50%) scale(1.06); }
}
.charge-lightning {
position: absolute; width: 2px; background: linear-gradient(to bottom, transparent, #00d4ff, transparent);
border-radius: 1px; opacity: 0; pointer-events: none; z-index: 1;
animation: lightningDrop var(--lt-dur, 1.5s) ease-in var(--lt-delay, 0s) infinite;
}
@keyframes lightningDrop {
0% { opacity: 0; transform: translateY(-30px) scaleY(0.3); }
20% { opacity: 0.9; }
80% { opacity: 0.5; transform: translateY(40px) scaleY(1); }
100% { opacity: 0; transform: translateY(60px) scaleY(0.5); }
}
.speed-meteor {
position: absolute; width: 20px; height: 1.5px; border-radius: 1px;
background: linear-gradient(to right, transparent, #a78bfa, transparent);
opacity: 0; pointer-events: none; z-index: 1;
animation: meteorFly var(--met-dur, 1s) ease-out var(--met-delay, 0s) infinite;
}
@keyframes meteorFly {
0% { opacity: 0; transform: translate(0, 0) rotate(var(--met-angle, 0deg)) scaleX(0.3); }
15% { opacity: 0.8; }
100% { opacity: 0; transform: translate(var(--met-dx, 40px), var(--met-dy, 0px)) rotate(var(--met-angle, 0deg)) scaleX(1.5); }
}
.temp-heat .h-ring-glow { stroke: rgba(255,71,87,0.6) !important; animation: tempPulse 1.5s ease-in-out infinite; }
.temp-warm .h-ring-glow { stroke: rgba(255,165,2,0.5) !important; }
@keyframes tempPulse { 0%, 100% { filter: blur(6px); opacity: 0.4; } 50% { filter: blur(12px); opacity: 0.7; } }
.data-pulse-ring {
position: absolute; top: 50%; left: 50%; width: 60px; height: 60px;
border: 1.5px solid var(--p-color, #00d4ff); border-radius: 50%;
transform: translate(-50%, -50%); opacity: 0; pointer-events: none; z-index: 0;
animation: dataPulseExpand 1s ease-out forwards;
}
@keyframes dataPulseExpand {
0% { width: 60px; height: 60px; opacity: 0.6; border-width: 2px; }
100% { width: 200px; height: 200px; opacity: 0; border-width: 0.5px; }
}
.h-ring-halo { fill: none; stroke-width: 1.5; stroke-dasharray: 6 4; opacity: 0.5; stroke: var(--p-color); animation: haloRotate 8s linear infinite; }
.h-ring-halo-2 { animation-duration: 12s; opacity: 0.35; }
@keyframes haloRotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.halo-ccw .h-ring-halo { animation-direction: reverse; }
.prem-section { background: var(--sec-bg); border-radius: 8px; padding: 10px; margin-bottom: 10px; border: 1px solid var(--border); transition: background 0.3s, border-color 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.prem-section-title { font-size: 13px; font-weight: bold; color: var(--accent); margin-bottom: 8px; letter-spacing: 1px; text-shadow: 0 0 8px rgba(0, 212, 255, 0.5), 0 0 2px rgba(0, 212, 255, 0.8); }
html.light-mode .prem-section-title { color: #0066ff; text-shadow: 0 0 6px rgba(0, 102, 255, 0.25); }
.prem-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 5px; }
.prem-card { background: var(--card-bg); border-radius: 5px; padding: 10px 4px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--border); transition: background 0.3s, border-color 0.3s, transform 0.2s; }
html:not(.light-mode) .prem-card { border: 1px solid rgba(255,255,255,0.03); }
.prem-card:hover { transform: translateY(-1px); }
.prem-card-label { font-size: 9px; color: var(--text2); margin-bottom: 5px; display: flex; align-items: center; justify-content: center; gap: 2px; }
html:not(.light-mode) .prem-card-label { text-shadow: 0 0 4px rgba(255,255,255,0.15); }
.prem-card-val { font-size: 12px; font-weight: bold; font-family: var(--mono); color: var(--text); }
html:not(.light-mode) .prem-card-val { text-shadow: 0 0 6px rgba(255,255,255,0.2); }
html.light-mode .prem-card-val { color: var(--text); }
html.light-mode .prem-card-label { color: var(--text2); }
.prem-grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 6px; margin-bottom: 6px; }
.prem-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 6px; }
@media (max-width: 480px) { .prem-grid-2 { grid-template-columns: 1fr; } }
.prem-val-huge { font-size: 22px; font-weight: bold; color: var(--accent); font-family: var(--mono); line-height: 1.1; }
.prem-unit-small { font-size: 12px; color: var(--text2); margin-left: 2px; text-shadow: 0 0 3px rgba(255,255,255,0.1); }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.65); z-index: 9999; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-content { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 25px 20px; width: 85%; max-width: 480px; text-align: center; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.modal-close { position: absolute; top: 12px; right: 15px; font-size: 26px; color: var(--muted); cursor: pointer; transition: color 0.2s; line-height: 1; }
.modal-close:hover { color: var(--warn); }
@media (max-width: 768px) {
.dev-state { height: 34px; padding: 0 8px; border-radius: 8px; }
.dev-heart { font-size: 20px; }
.dev-uptime { font-size: 11px; }
.dev-soc { font-size: 11px; }
.conn-icons { gap: 3px; margin-left: 4px; padding-left: 4px; }
.conn-icon { width: 22px; height: 22px; border-radius: 5px; }
.conn-icon svg { width: 12px; height: 12px; }
.conn-icon .status-dot { width: 6px; height: 6px; border-width: 1.5px; }
.top-actions { gap: 4px; }
.top-btn, #theme-toggle { font-size: 12px; padding: 4px 7px; }
.top-btn .btn-text { display: none; }
.btn-svg { width: 15px; height: 15px; }
.prem-hero-card { padding: 0; margin: 0; border-radius: 8px; }
.bms-panel { border-radius: 10px; }
.panel-header { padding: 4px 8px; }
.panel-title { font-size: 13px; }
.panel-body { padding: 3px 8px; }
.data-row { padding: 2px 0; font-size: 12px; }
.cell-bar-track { height: 44px; max-width: 18px; }
.cell-bar-val { font-size: 8px; }
.cell-bar-num { font-size: 8px; }
.cell-item { padding: 5px 2px; }
  .cell-val { font-size: 12px; }
.batt-cell-svg { width: 24px; height: 34px; }
.batt-cell-val { font-size: 9px; }
.batt-cell-res { font-size: 8px; }
.alarm-grid { grid-template-columns: repeat(2, 1fr); }
/* 新布局响应式 */
@media (max-width: 360px) {
    .bms-top-layout { gap: 8px; padding: 8px; }
    .ring-box { width: 96px; height: 96px; }
    .action-btn { padding: 10px 12px; font-size: 12px; }
    .action-btn svg { width: 18px; height: 18px; }
}
.info-card { width: 160px; padding: 6px 7px; font-size: 11px; top: 4px; left: 4px; }
.info-row { margin: 1px 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-row-actions { gap: 3px; margin: 2px 0; }
.info-row-actions button { padding: 3px 1px; font-size: 9px; }
.speed-display { font-size: 14px; }
.card-header { font-size: 12px; margin-bottom: 2px; }
button:not(.tab-btn, #theme-toggle, .top-btn) { padding: 4px 8px; font-size: 10px; }
.control-panel { padding: 8px; gap: 6px; width: 95%; max-width: none; bottom: 8px; }
.tab-btn { font-size: 14px; }
}
#speed-select {
-webkit-appearance: none;
appearance: none;
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
padding: 0 18px 0 4px;
opacity: 1;
}
#speed-select:disabled {
opacity: 1;
color: var(--text);
background: var(--bg);
}
#speed-select option {
background: var(--bg);
color: var(--text);
}
/* === 通用工具类 === */
.c-accent{color:var(--accent)} .c-text{color:var(--text)} .c-text2{color:var(--text2)}
.c-green{color:var(--green)} .c-yellow{color:var(--yellow)} .c-warn{color:var(--warn)}
.c-white{color:#fff} .c-muted{color:var(--muted)}
.fs-9{font-size:9px} .fs-11{font-size:11px} .fs-12{font-size:12px}
.fs-13{font-size:13px} .fs-14{font-size:14px} .fs-16{font-size:16px}
.fw-bold{font-weight:bold} .ff-mono{font-family:var(--mono)}
.d-flex{display:flex} .d-none{display:none} .d-block{display:block}

/* ================================================================
以下为 V2 新增样式：状态徽章 + 加热指示 + 告警面板
================================================================ */
/* 保留到 tooltip-box 结束，其余 V2 未使用样式已清理 */
