:root {
    --bg-color: #121212;
    --panel-bg: rgba(40, 40, 42, 0.6);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #f5f5f7;
    --text-muted: #86868b;
    --accent-color: #0A84FF; /* Apple Blue */
    --accent-hover: #0071e3;
    --radius-large: 16px;
    --radius-small: 8px;
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    --red-color: #ff453a;
    --green-color: #32d74b;
    --yellow-color: #ffd60a;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* 毛玻璃公共类 */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-large);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* 顶部栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    margin: 16px;
    border-radius: 20px;
}

.logo-area h2 { font-size: 20px; font-weight: 600; letter-spacing: 1px; }
.logo-area .sub-title { font-size: 12px; color: var(--text-muted); }

.control-area { display: flex; align-items: center; gap: 16px; }

/* 控件样式 */
.apple-btn, .apple-select {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-small);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.apple-btn:hover { background: var(--accent-hover); }
.apple-btn.outline { background: transparent; border: 1px solid var(--panel-border); color: var(--text-main); }
.apple-btn.outline:hover { background: rgba(255,255,255,0.1); }
.apple-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 录屏按钮特殊样式 */
.rec-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 6px;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.rec-icon.active {
    background: var(--red-color);
    box-shadow: 0 0 8px var(--red-color);
    animation: pulse-rec 1.2s ease-in-out infinite;
}

@keyframes pulse-rec {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#btn-screen-record.recording {
    border-color: var(--red-color);
    color: var(--red-color);
}

.status-indicator { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-right: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.online { background-color: #32d74b; box-shadow: 0 0 8px #32d74b; }
.dot.offline { background-color: #ff453a; box-shadow: 0 0 8px #ff453a; }

/* 主体布局 */
.dashboard-layout {
    display: flex;
    flex: 1;
    padding: 0 16px 16px;
    gap: 24px;
}

/* 左侧面板 */
.left-panel { width: 280px; display: flex; flex-direction: column; gap: 16px; }
.data-card { padding: 24px; }
.data-card h3 { font-size: 16px; color: var(--text-muted); margin-bottom: 16px; font-weight: 500;}
.data-card h3 small { font-size: 12px; opacity: 0.7; }
.data-row { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; border-bottom: 1px solid var(--panel-border); padding-bottom: 8px;}
.data-value { font-weight: 600; font-family: monospace; font-size: 16px; }

.highlight-card { border-top: 3px solid var(--accent-color); }
.big-data { font-size: 48px; font-weight: 700; color: var(--text-main); font-family: -apple-system; margin: 16px 0; }

/* 新增：图表卡片 */
.chart-card {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex: 1;
    position: relative;
    border-radius: var(--radius-small);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
}

.chart-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.left-dot { background: #0A84FF; }
.legend-dot.right-dot { background: #FF9F0A; }
.legend-dot.total-dot { background: #32d74b; }

/* 中央渲染区 */
.render-area {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 40px;
    position: relative;
}

.canvas-container {
    position: relative;
    width: 400px;
    height: 600px;
    border-radius: var(--radius-large);
    overflow: hidden;
}

.hand-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    z-index: 1;
    opacity: 0.8;
}

canvas:not(.three-canvas) {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none; 
}

/* 右侧面板 (渐变标尺) */
.right-panel { width: 80px; display: flex; align-items: center; justify-content: center; }
.color-scale { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 300px;}
.scale-label { font-size: 12px; color: var(--text-muted); }
.gradient-bar {
    width: 20px;
    flex: 1;
    border-radius: 10px;
    background: linear-gradient(to bottom, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff);
    border: 1px solid var(--panel-border);
}

/* 录屏浮层 */
.recording-overlay {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.recording-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-20px);
}

.recording-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 69, 58, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 69, 58, 0.4);
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--red-color);
    box-shadow: 0 4px 20px rgba(255, 69, 58, 0.2);
}

.rec-pulse {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red-color);
    animation: pulse-rec 1.2s ease-in-out infinite;
}

/* 图表区域 canvas 不需要 absolute 定位 */
.chart-container canvas {
    position: relative;
}
