    
        :root {
            /* 默认使用 Orange Theme (参考截图) */
            --bg-color: #121212;
            --panel-bg: #1e1e1e;
            --text-main: #e0e0e0;
            --text-muted: #888;
            --accent-cyan: #ff9800;   /* 主橙色 */
            --accent-magenta: #ffb74d; /* 辅助橙色/高亮 */
            --accent-green: #4caf50;
            --border-color: #333333;
            --viz-bg: #1a1a1a;
            --radius-md: 12px;
            --radius-sm: 8px;
        }

        /* 设备适配：桌面端/平板端字体放大 */
        :root.device-desktop {
            font-size: 19.2px; /* 16px * 1.2 */
        }

        /* 主题定义 - 保留其他作为可选项 */
         body[data-theme="cyberpunk"] {
             --bg-color: #050505;
             --panel-bg: rgba(20, 20, 20, 0.85);
             --text-main: #e0e0e0;
             --text-muted: #888;
             --accent-cyan: #00f3ff;
             --accent-magenta: #ff00ff;
             --accent-green: #00ff66;
             --border-color: rgba(255,255,255, 0.15);
             --viz-bg: radial-gradient(circle at center, #111 0%, #000 100%);
         }


        /* 主题定义 */
        body[data-theme="matrix"] {
            --bg-color: #000000;
            --panel-bg: rgba(0, 20, 0, 0.9);
            --text-main: #00ff00;
            --text-muted: #008800;
            --accent-cyan: #00ff00; /* 主色调 */
            --accent-magenta: #008f11; /* 辅色调 */
            --accent-green: #00ff00;
            --border-color: rgba(0, 255, 0, 0.2);
            --viz-bg: #000;
        }

        body[data-theme="ocean"] {
            --bg-color: #001f3f;
            --panel-bg: rgba(0, 31, 63, 0.85);
            --text-main: #b3e5fc;
            --text-muted: #568ea3;
            --accent-cyan: #7FDBFF;
            --accent-magenta: #0074D9;
            --accent-green: #39CCCC;
            --border-color: rgba(127, 219, 255, 0.2);
            --viz-bg: linear-gradient(to bottom, #001f3f, #001020);
        }

        body[data-theme="sunset"] {
            --bg-color: #2d1b2e;
            --panel-bg: rgba(45, 27, 46, 0.85);
            --text-main: #ffd1dc;
            --text-muted: #b07289;
            --accent-cyan: #ff9e64;
            --accent-magenta: #ff0055;
            --accent-green: #ffca28;
            --border-color: rgba(255, 158, 100, 0.2);
            --viz-bg: linear-gradient(to bottom, #2d1b2e, #1a0f1a);
        }

        body[data-theme="light"] {
            --bg-color: #f0f2f5;
            --panel-bg: rgba(255,255,255, 0.9);
            --text-main: #333333;
            --text-muted: #666666;
            --accent-cyan: #2196F3;
            --accent-magenta: #673AB7;
            --accent-green: #4CAF50;
            --border-color: rgba(0, 0, 0, 0.1);
            --viz-bg: #e0e0e0;
        }

        /* 新增主题：猛男粉 */
        body[data-theme="pink"] {
            --bg-color: #2e001f;
            --panel-bg: rgba(60, 0, 40, 0.85);
            --text-main: #ffc2d1;
            --text-muted: #d88fa5;
            --accent-cyan: #ff4081;
            --accent-magenta: #f50057;
            --accent-green: #ff80ab;
            --border-color: rgba(255, 64, 129, 0.2);
            --viz-bg: linear-gradient(to bottom, #2e001f, #1a0010);
        }

        /* 新增主题：基佬紫 */
        body[data-theme="purple"] {
            --bg-color: #1a002e;
            --panel-bg: rgba(40, 0, 60, 0.85);
            --text-main: #e1bee7;
            --text-muted: #ba68c8;
            --accent-cyan: #d500f9;
            --accent-magenta: #aa00ff;
            --accent-green: #e040fb;
            --border-color: rgba(213, 0, 249, 0.2);
            --viz-bg: linear-gradient(to bottom, #1a002e, #0d0017);
        }

        /* 新增主题：蕾丝红 */
        body[data-theme="red"] {
            --bg-color: #2b0000;
            --panel-bg: rgba(50, 0, 0, 0.85);
            --text-main: #ffcdd2;
            --text-muted: #e57373;
            --accent-cyan: #ff1744;
            --accent-magenta: #d50000;
            --accent-green: #ff5252;
            --border-color: rgba(255, 23, 68, 0.2);
            --viz-bg: linear-gradient(to bottom, #2b0000, #150000);
        }

        /* 新增主题：流氓黑 */
        body[data-theme="black"] {
            --bg-color: #000000;
            --panel-bg: #111111;
            --text-main: #ffffff;
            --text-muted: #666666;
            --accent-cyan: #ffffff;
            --accent-magenta: #333333;
            --accent-green: #999999;
            --border-color: #333333;
            --viz-bg: #000000;
        }


        /* 主题定义 */
        body.theme-matrix {
            --bg-color: #000000;
            --panel-bg: rgba(0, 20, 0, 0.9);
            --text-main: #00ff00;
            --text-muted: #008800;
            --accent-cyan: #00ff00; /* 主色调 */
            --accent-magenta: #008f11; /* 辅色调 */
            --accent-green: #00ff00;
            --border-color: rgba(0, 255, 0, 0.2);
            --viz-bg: #000;
        }

        body.theme-ocean {
            --bg-color: #001f3f;
            --panel-bg: rgba(0, 31, 63, 0.85);
            --text-main: #b3e5fc;
            --text-muted: #568ea3;
            --accent-cyan: #7FDBFF;
            --accent-magenta: #0074D9;
            --accent-green: #39CCCC;
            --border-color: rgba(127, 219, 255, 0.2);
            --viz-bg: linear-gradient(to bottom, #001f3f, #001020);
        }

        body.theme-sunset {
            --bg-color: #2d1b2e;
            --panel-bg: rgba(45, 27, 46, 0.85);
            --text-main: #ffd1dc;
            --text-muted: #b07289;
            --accent-cyan: #ff9e64;
            --accent-magenta: #ff0055;
            --accent-green: #ffca28;
            --border-color: rgba(255, 158, 100, 0.2);
            --viz-bg: linear-gradient(to bottom, #2d1b2e, #1a0f1a);
        }

        body.theme-light {
            --bg-color: #f0f2f5;
            --panel-bg: rgba(255, 255, 255, 0.9);
            --text-main: #333333;
            --text-muted: #666666;
            --accent-cyan: #2196F3;
            --accent-magenta: #673AB7;
            --accent-green: #4CAF50;
            --border-color: rgba(0, 0, 0, 0.1);
            --viz-bg: #e0e0e0;
        }

        /* 新增主题：猛男粉 */
        body.theme-pink {
            --bg-color: #2e001f;
            --panel-bg: rgba(60, 0, 40, 0.85);
            --text-main: #ffc2d1;
            --text-muted: #d88fa5;
            --accent-cyan: #ff4081;
            --accent-magenta: #f50057;
            --accent-green: #ff80ab;
            --border-color: rgba(255, 64, 129, 0.2);
            --viz-bg: linear-gradient(to bottom, #2e001f, #1a0010);
        }

        /* 新增主题：基佬紫 */
        body.theme-purple {
            --bg-color: #1a002e;
            --panel-bg: rgba(40, 0, 60, 0.85);
            --text-main: #e1bee7;
            --text-muted: #ba68c8;
            --accent-cyan: #d500f9;
            --accent-magenta: #aa00ff;
            --accent-green: #e040fb;
            --border-color: rgba(213, 0, 249, 0.2);
            --viz-bg: linear-gradient(to bottom, #1a002e, #0d0017);
        }

        /* 新增主题：蕾丝红 */
        body.theme-red {
            --bg-color: #2b0000;
            --panel-bg: rgba(50, 0, 0, 0.85);
            --text-main: #ffcdd2;
            --text-muted: #e57373;
            --accent-cyan: #ff1744;
            --accent-magenta: #d50000;
            --accent-green: #ff5252;
            --border-color: rgba(255, 23, 68, 0.2);
            --viz-bg: linear-gradient(to bottom, #2b0000, #150000);
        }

        *

        /* 只在特定元素上禁用用户选择，避免影响输入框 */
        button, .btn-rect-lg, .theme-btn, .station-item, .station-drag-handle, .qso-item {
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        /* 允许输入框和文本区域选择 */
        input, textarea, .debug-content {
            user-select: auto;
            -webkit-user-select: text;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-main);
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            height: 100dvh; /* 适配移动端视口 */
            display: grid;
            grid-template-rows: auto auto 1fr auto; /* Header, Settings, Viz, Controls */
            grid-template-areas:
                "header"
                "settings"
                "viz"
                "controls";
            overflow: hidden;
            transition: background-color 0.5s, color 0.5s;

            /* Safe Area Adaptation */
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);

            /* iOS 滚动兼容：在 iOS 设备上保留部分 overscroll 行为 */
            overscroll-behavior: none; /* 防止页面整体回弹 */
        }

        /* iOS 特定调整：确保可滚动容器能够正常工作 */
        @supports (-webkit-touch-callout: none) {
            body {
                overscroll-behavior: auto; /* iOS 上允许原生滚动行为 */
            }
        }

        /* 按钮触摸优化 - 移除 .station-item 以允许滚动 */
        button, .btn-rect-lg, .vol-track-wrapper {
            touch-action: manipulation;
        }

        /* Toggle Switch Button */
        .switch-toggle {
            position: relative;
            display: inline-block;
            width: 44px;
            height: 24px;
            margin-right: 12px;
            flex-shrink: 0;
        }

        .switch-toggle input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #333;
            transition: .4s;
            border-radius: 2px;
            border: 1px solid var(--border-color);
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 2px; /* (24-2-2-18)/2 ? No, 24 height. border 1. content 22. 18 circle. (22-18)/2 = 2. */
            background-color: #888;
            transition: .4s;
            border-radius: 1px;
        }

        input:checked + .slider {
            background-color: rgba(255, 152, 0, 0.2); /* Tint background with accent */
            border-color: var(--accent-cyan);
        }

        input:checked + .slider:before {
            transform: translateX(20px);
            background-color: var(--accent-cyan);
        }

        input:focus + .slider {
            box-shadow: 0 0 1px var(--accent-cyan);
        }

        /* 顶部状态栏 */
        header {
            grid-area: header;
            padding: 10px 15px; /* 减少 padding */
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--panel-bg);
            border-bottom: 1px solid var(--border-color);
            z-index: 100;
            transition: background 0.5s, border-color 0.5s;
            margin: 10px 10px 0 10px;
            border-radius: var(--radius-md);
        }

        .brand {
            font-size: 0.95rem;
            font-weight: bold;
            letter-spacing: 0.5px;
            color: var(--accent-cyan);
            display: flex;
            align-items: center;
            gap: 6px;
            white-space: normal; /* 允许换行 */
            min-width: 0; /* 允许在 flex 容器中收缩 */
        }
        .brand span {
            display: block;
            line-height: 1.1; /* 紧凑行高，适合两行显示 */
        }
        .brand::before {
            content: 'F';
            background: var(--accent-cyan);
            color: #000;
            width: 24px;
            height: 24px;
            min-width: 24px; /* 防止压缩 */
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 900;
        }
        
        .header-right {
            display: flex;
            align-items: center;
            gap: 6px; /* 更加紧凑 */
        }

        /* 小屏幕适配 (< 380px) */
        @media (max-width: 380px) {
            html { font-size: 14px; } /* 缩小基准字体 */
            .brand span { display: none; } /* 隐藏文字只留 Logo */
            .header-right { gap: 4px; }
            .qso-count-badge { padding: 0 6px; }
            header { padding: 8px 10px; }
        }

        /* 输入框允许选择 */
        input, textarea {
            user-select: auto;
        }

        .theme-btn {
            background: transparent;
            border: 1px solid var(--border-color); /* 保持微妙边框 */
            color: var(--accent-cyan); /* 统一主题色 */
            width: 28px; /* 缩小尺寸 */
            height: 28px;
            border-radius: 6px; /* 稍微减小圆角 */
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            padding: 0;
        }
        .theme-btn svg {
            width: 16px;
            height: 16px;
        }
        .theme-btn:active { background: rgba(255,255,255,0.1); }

        .status-indicators {
            display: flex;
            gap: 8px;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #555;
            transition: all 0.3s ease;
        }
        .status-dot.connected { background-color: var(--accent-green); box-shadow: 0 0 5px var(--accent-green); }
        .status-dot.error { background-color: #ff3333; box-shadow: 0 0 5px #ff3333; }

        /* 主可视区域 */
        .viz-container {
            grid-area: viz;
            position: relative;
            background: var(--viz-bg);
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            cursor: pointer; /* 提示可点击 */
            min-height: 0; /* 防止 grid item 溢出 */
            margin: 10px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-color);
        }

        canvas {
            width: 100%;
            height: 100%;
            display: block;
        }

        .viz-info-container {
            position: absolute;
            top: 15px;
            right: 15px;
            display: flex;
            gap: 10px;
            pointer-events: none;
            z-index: 10;
            align-items: center;
        }

        #current-station-text {
            /* Remove absolute positioning, handled by container */
            position: static;
        }

        .bottom-right-group {
            position: absolute;
            bottom: 15px;
            left: 15px;
            display: flex;
            gap: 8px;
            z-index: 10;
            align-items: center;
        }

        .viz-mode-badge {
            padding: 4px 10px;
            background: var(--accent-cyan);
            border: none;
            border-radius: 4px;
            color: #000;
            font-weight: bold;
            font-size: 0.75rem;
            pointer-events: auto; /* Allow clicks */
            cursor: pointer; /* Show pointer */
            opacity: 1;
            white-space: nowrap;
        }

        /* 呼号显示组件 */
        .callsign-ticker-container {
            position: absolute;
            top: 20px;
            left: 10px;
            bottom: 50px; /* 留出底部空间 */
            width: auto;
            max-width: 140px;
            display: flex;
            flex-direction: column; /* 垂直排列 */
            justify-content: flex-start; /* 从上往下 */
            align-items: flex-start; /* 左对齐 */
            padding: 10px 0;
            box-sizing: border-box;
            overflow: hidden;
            pointer-events: none;
            z-index: 20;
            mask-image: linear-gradient(to bottom, black 80%, transparent); /* 底部淡出 */
            -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent);
        }

        .callsign-item {
            background: rgba(0, 0, 0, 0.4);
            color: var(--accent-cyan);
            padding: 6px 10px;
            border-radius: 8px; /* Slightly less rounded for rect shape */
            margin-bottom: 10px; /* 垂直间距 */
            font-family: 'Roboto Mono', monospace;
            white-space: nowrap;
            border: 1px solid rgba(255, 255, 255, 0.1);
            
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;

            /* 初始状态用于动画 */
            opacity: 0;
            transform: translateX(-20px); /* 从左侧滑入 */
            max-height: 0; /* 高度动画 */
            margin-bottom: 0;
            
            transition: 
                opacity 0.3s ease,
                transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                max-height 0.4s ease,
                padding 0.4s ease,
                margin-bottom 0.4s ease,
                color 0.1s, text-shadow 0.1s, border-color 0.1s, background-color 0.1s; /* 呼吸灯快速响应 */
        }

        .callsign-time {
            font-size: 10px;
            color: #00ff00;
            margin-bottom: 2px;
            line-height: 1;
            font-weight: bold;
            font-family: 'Courier New', Courier, monospace;
            text-shadow: 0 0 4px #00ff00;
            letter-spacing: 1px;
        }

        .callsign-text {
            font-size: 14px;
            font-weight: bold;
            line-height: 1.2;
        }

        .callsign-item.active {
            opacity: 1;
            transform: translateX(0);
            max-height: 80px; /* 展开高度 */
            padding: 6px 10px;
            margin-bottom: 10px;
        }

        /* 呼吸灯动态样式 (通过 JS CSS 变量控制) */
        .callsign-item.breathing {
            --level: 0; /* JS will update this 0-1 */
            
            /* 颜色在主题色和亮白色之间变化 */
            color: color-mix(in srgb, var(--accent-cyan), #fff calc(var(--level) * 50%));
            
            /* 发光效果 */
            text-shadow: 0 0 calc(5px + 10px * var(--level)) var(--accent-cyan);
            
            /* 边框亮起 */
            border-color: rgba(255, 255, 255, calc(0.2 + 0.6 * var(--level)));
            
            /* 背景微亮 */
            background-color: rgba(0, 0, 0, calc(0.4 + 0.2 * var(--level)));
        }

        /* 星星图标样式 */
        .star-icon {
            font-size: 14px;
            margin-right: 4px;
            margin-bottom: 0;
            display: inline-block;
            vertical-align: middle;
            color: #FFD700; /* 金色 */
        }
        
        .star-icon.solid {
            color: #FFD700;
        }
        
        .star-icon.hollow {
            color: #FFD700;
            animation: blink-star 1s infinite;
        }
        
        @keyframes blink-star {
            0% { opacity: 1; }
            50% { opacity: 0.3; }
            100% { opacity: 1; }
        }

        /* 按钮触摸优化 */
        button, .btn-rect-lg, .vol-track-wrapper {
            touch-action: manipulation;
        }

        .controls-area { 
            grid-area: controls; 
            background: var(--panel-bg); 
            border-top: 1px solid var(--border-color); 
            padding: 20px; 
            display: flex; 
            flex-direction: column; 
            gap: 15px; 
            height: auto; 
            max-height: 50vh; 
            overflow-y: hidden; /* 关键：禁用父容器纵向滚动 */ 
            overflow-x: hidden;
            align-items: stretch;
            transition: background 0.5s, border-color 0.5s; 
            margin: 0 10px 10px 10px; 
            border-radius: var(--radius-md); 
            border: 1px solid var(--border-color); 
        }

        /* 播放控制 */


        .control-btn-group {
            display: flex;
            gap: 15px;
            align-items: center;
            justify-content: space-between; /* 在小屏上分散对齐，或 center */
            width: 100%;
        }

        /* 统一大按钮样式 - 调整为矩形 */
        .btn-rect-lg {
            height: 40px; /* 降低高度 (原48px) */
            flex: 1; /* 均匀分布 */
            min-width: 0;
            padding: 0;
            border-radius: 6px; /* 稍微减小圆角 */
            border: 1px solid var(--accent-magenta);
            background: rgba(255, 152, 0, 0.1);
            color: var(--accent-cyan);
            font-size: 1.1rem; /* 稍微调小图标 */
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: all 0.2s;
            box-shadow: none;
        }
        
        /* 播放按钮突出显示 */
        #btn-play {
            background: var(--accent-cyan);
            color: #000;
            border: none;
            flex: 2; /* 更宽 */
        }
        #btn-play:active { transform: scale(0.98); opacity: 0.9; }

        /* 顶部设置区域 */
        #settings-area {
            grid-area: settings;
            background: var(--panel-bg);
            border-bottom: 1px solid var(--border-color);
            padding: 0 20px;
            max-height: 0; /* Use max-height for transition */
            overflow: hidden;
            transition: max-height 0.3s ease, padding 0.3s ease;
            z-index: 99;
            margin: 0 10px;
            border-radius: 0 0 var(--radius-md) var(--radius-md);
            margin-top: -10px; /* 连接 Header */
            border-top: none;
        }
        #settings-area.open {
            max-height: 300px; /* Enough space for content */
            padding: 20px;
            margin-bottom: 10px;
        }
        
        /* 历史设备列表样式 */
        .device-history {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
            opacity: 0;
            transform: translateY(-10px);
            transition: all 0.3s ease;
        }
        #settings-area.open .device-history {
            opacity: 1;
            transform: translateY(0);
        }

        .device-tag {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid var(--border-color);
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.85rem;
            color: var(--text-muted);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .device-tag:hover {
            background: rgba(255, 255, 255, 0.2);
            color: var(--text-main);
        }
        .device-tag.active {
            border-color: var(--accent-cyan);
            color: var(--accent-cyan);
            background: rgba(0, 243, 255, 0.1);
        }
        .device-del {
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: rgba(0,0,0,0.3);
            font-size: 10px;
            line-height: 1;
            color: #aaa;
        }
        .device-del:hover {
            background: #ff3333;
            color: white;
        }
        .btn-rect-lg:active { transform: scale(0.95); background: rgba(255,255,255,0.1); }
        .btn-rect-lg.active { background: var(--accent-magenta); color: var(--bg-color); box-shadow: 0 0 15px var(--accent-magenta); }

        /* 录音按钮特殊样式覆盖 */
        .btn-record {
            border-color: #ff3333;
            color: #ff3333;
        }
        .btn-record.recording {
            background: rgba(255, 51, 51, 0.2);
            box-shadow: 0 0 15px #ff3333;
            animation: pulse 1.5s infinite;
        }
        .btn-record .icon {
            width: 14px;
            height: 14px;
            background-color: currentColor;
            border-radius: 50%; /* 录音图标为圆点 */
            transition: all 0.2s;
        }
        .btn-record.recording .icon {
            border-radius: 50%;
            transform: scale(0.8);
        }

        /* 音量条容器 */
        .vol-bar-container {
            display: flex;
            align-items: center;
            width: 100%;
            height: 48px;
            padding: 0 15px;
            box-sizing: border-box;
            background: rgba(0,0,0,0.2);
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-color);
        }

        .vol-icon {
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            margin-right: 15px;
            cursor: pointer;
        }
        
        .vol-track-wrapper {
            flex: 1;
            height: 48px; /* 增大触摸热区 */
            display: flex;
            align-items: center;
            cursor: pointer;
            position: relative;
        }

        .vol-track {
            width: 100%;
            height: 6px; /* 加粗 */
            background: #333;
            border-radius: 3px;
            position: relative;
            overflow: visible;
        }

        .vol-fill {
            height: 100%;
            background: var(--accent-cyan);
            border-radius: 3px;
            width: 50%; /* 默认值 */
            position: relative;
            box-shadow: none;
            transition: width 0.1s linear;
        }

        /* 滑块头部圆点 */
        .vol-thumb {
            width: 18px;
            height: 18px;
            background: var(--accent-cyan);
            border-radius: 50%;
            position: absolute;
            right: -9px;
            top: 50%;
            transform: translateY(-50%);
            box-shadow: 0 0 5px rgba(0,0,0,0.5);
            transition: transform 0.1s;
            border: 2px solid #fff;
        }
        
        .vol-track-wrapper:active .vol-thumb {
            transform: translateY(-50%) scale(1.1);
        }

        .vol-value-text {
            width: 45px;
            text-align: right;
            font-size: 14px;
            color: var(--text-muted);
            font-family: monospace;
            margin-left: 15px;
        }

        /* 本地静音开关 */
        .local-mute-toggle {
            width: 40px;
            height: 20px;
            margin-left: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            transition: all 0.2s;
            border: 1px solid transparent;
        }
        .local-mute-toggle.active { /* 静音开启 (红色) */
            background-color: rgba(255, 69, 58, 0.2);
            color: #ff453a;
            border-color: #ff453a;
        }
        .local-mute-toggle.inactive { /* 静音关闭 (绿色) */
            background-color: rgba(48, 209, 88, 0.2);
            color: #30d158;
            border-color: #30d158;
        }

        /* 旧样式保留用于非modal的station-item */
        .station-item {
            touch-action: manipulation;
            padding: 10px;
            background: rgba(255,255,255,0.05);
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: flex-start;
            transition: all 0.2s;
            border-left: 3px solid transparent;
            font-size: 0.9rem;
            cursor: pointer;
        }
        .station-item.active {
            background: rgba(0, 243, 255, 0.1);
            border-left-color: var(--accent-cyan);
        }
        .station-item:active { background: rgba(255,255,255,0.1); }

        .st-name {
            font-weight: 500;
            width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            pointer-events: none; /* Fix click not bubbling to parent */
        }

        /* Station Panel */
        .station-panel {
            background: rgba(0,0,0,0.2);
            border-radius: var(--radius-md);
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 6px;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        .station-panel .station-header {
            font-size: 0.75rem;
            margin-bottom: 4px;
        }
        .station-map-panel {
            flex: 1 1 auto;
            min-height: 0;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-color);
            overflow: hidden;
            background: rgba(0,0,0,0.2);
        }
        .station-map-panel iframe {
            width: 100%;
            height: 100%;
            display: block;
            border: none;
        }
        .station-location-box {
            width: 100%;
            max-width: 100%;
            min-height: 44px;
            padding: 10px 12px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-color);
            background: rgba(0,0,0,0.2);
            color: var(--text-main);
            font-size: 0.8rem;
            line-height: 1.4;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
            box-sizing: border-box;
            overflow-wrap: anywhere;
        }
        .station-location-box .loc-callsign {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background: rgba(255, 255, 255, 0.08);
            color: var(--text-main);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            box-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
            font-weight: 600;
            letter-spacing: 0.3px;
        }
        .station-location-box .loc-sep {
            color: var(--text-muted);
        }
        .station-location-box .loc-text {
            color: #7CFF6B;
            text-shadow: 0 0 6px rgba(124, 255, 107, 0.4);
            font-weight: 600;
        }
        .station-location-box .loc-text.wait,
        .station-location-box .loc-text.empty {
            color: var(--text-muted);
            text-shadow: none;
            font-weight: 500;
        }
        .station-location-box .loc-text.error {
            color: #ff6b6b;
            text-shadow: 0 0 6px rgba(255, 107, 107, 0.4);
        }

        /* 设置面板 */
        .settings-panel {
            padding-top: 10px;
            border-top: 1px solid var(--border-color);
        }
        .input-group {
            display: flex;
            gap: 10px;
        }
        .input-dark {
            flex: 1;
            background: rgba(0,0,0,0.3);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            padding: 10px;
            border-radius: 8px;
            font-family: monospace;
        }
        .btn-small {
            padding: 0 15px;
            background: rgba(255,255,255,0.1);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            border-radius: 8px;
            font-size: 0.9rem;
        }
        .btn-small:active { background: rgba(255,255,255,0.2); }

        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(255, 51, 51, 0.4); }
            70% { box-shadow: 0 0 0 8px rgba(255, 51, 51, 0); }
            100% { box-shadow: 0 0 0 0 rgba(255, 51, 51, 0); }
        }

        /* 滚动条美化 */
        ::-webkit-scrollbar { width: 4px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

        /* 工具类 */
        .hidden { display: none !important; }
        .text-cyan { color: var(--accent-cyan); }
        
        /* 平板/桌面端适配 (Landscape & Large Screens) */
        @media (min-width: 768px), (orientation: landscape) and (min-height: 300px) and (min-width: 560px) {
            body {
                grid-template-columns: 1fr 340px; /* 固定右侧控制栏宽度 */
                grid-template-rows: auto auto 1fr;
                grid-template-areas: 
                    "header header"
                    "settings settings"
                    "viz controls";
            }

            .controls-area {
                height: 100%;
                max-height: none;
                border-top: none;
                border-left: 1px solid var(--border-color);
                padding-bottom: 20px;
                margin: 0 10px 10px 0; /* 调整 margin */
                border-radius: var(--radius-md);
            }

            .viz-container {
                height: auto; /* 自动填充 */
                margin: 0 10px 10px 10px; /* 调整 margin */
            }
            
            /* 在宽屏下增加台站列数 */
            .station-list {
                grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* 更紧凑 */
            }
        }
        
        /* 超大屏幕适配 */
        @media (min-width: 1200px) {
            body {
                grid-template-columns: 1fr 400px; /* 更宽的控制栏 */
            }
            .viz-container {
                margin: 0 15px 15px 15px;
            }
            .controls-area {
                margin: 0 15px 15px 0;
            }
        }

        /* Modal Styles - Glassmorphism & Redesign */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.7); /* 70% opacity black mask */
            z-index: 200;
            display: flex;
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(5px);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
        }
        .modal-overlay.show {
            opacity: 1;
            pointer-events: auto;
        }
        .modal-content {
            background: rgba(30, 30, 30, 0.9); /* 90% opacity */
            backdrop-filter: blur(10px); /* Glass effect */
            width: 95%; max-width: 1200px; height: 85vh; /* Larger size */
            border-radius: 12px;
            border: 1px solid rgba(255,255,255,0.2);
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            transform: translateY(20px);
            transition: transform 0.3s;
            overflow: hidden;
        }
        .modal-overlay.show .modal-content {
            transform: translateY(0);
        }
        .modal-header {
            padding: 15px 20px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(0,0,0,0.2);
        }
        
        /* Radio Icon & Pulse Animation */
        .radio-icon-container {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .radio-icon-svg {
            width: 48px;
            height: 48px;
            color: #2196F3;
            animation: radioPulse 2s infinite;
        }
        @keyframes radioPulse {
            0% { filter: drop-shadow(0 0 0 rgba(33, 150, 243, 0.7)); transform: scale(1); }
            50% { filter: drop-shadow(0 0 10px rgba(33, 150, 243, 0)); transform: scale(1.05); }
            100% { filter: drop-shadow(0 0 0 rgba(33, 150, 243, 0.7)); transform: scale(1); }
        }
        
        .modal-header h3 { margin: 0; color: #e0e0e0; font-size: 1.5rem; font-weight: bold; }
        .btn-icon { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; padding: 0 5px; transition: color 0.2s; }
        .btn-icon:hover { color: #fff; }

        /* Split Layout */
        .modal-body-split {
            display: flex;
            flex: 1;
            height: 100%;
            overflow: hidden;
        }

        .qso-list-panel {
            width: 35%; /* Increased width for details */
            overflow-y: auto;
            border-right: 1px solid rgba(255,255,255,0.1);
            background: rgba(0,0,0,0.2);
            padding: 0;
            display: flex;
            flex-direction: column;
        }
        
        /* Typography & List Item Styling */
        .qso-list-panel .qso-item {
            margin: 0;
            border-radius: 0;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            padding: 12px 15px;
            display: flex;
            flex-direction: column;
            align-items: flex-start; /* Left align */
            text-align: left;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
        }
        
        .qso-list-panel .qso-item:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        .qso-list-panel .qso-item:active {
            background: rgba(255, 255, 255, 0.1);
        }
        
        .qso-list-panel .qso-item.active {
            background: rgba(33, 150, 243, 0.15); /* Tech Blue tint */
            border-left: 3px solid #2196F3;
        }
        
        /* Focus state for keyboard navigation */
        .qso-list-panel .qso-item:focus {
            outline: 2px solid #2196F3;
            outline-offset: -2px;
            background: rgba(255, 255, 255, 0.08);
        }

        /* 1. Typography Hierarchy */
        .qso-main {
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .qso-call {
            font-size: 18px;
            font-weight: bold;
            color: #e0e0e0; /* Deep Gray/White */
            line-height: 1.5;
            margin-bottom: 2px;
        }

        .qso-data-highlight {
            color: #FF6B35; /* Orange Highlight */
        }

        .qso-time {
            font-family: monospace;
            font-size: 12px;
            color: #aaa;
            line-height: 1.5;
        }
        
        .qso-map-panel {
            width: 65%;
            background: #121212;
            position: relative;
        }

        #qso-map-frame {
            width: 100%;
            height: 100%;
            border: none;
            display: block;
        }

        /* Responsive */
        @media (max-width: 768px) {
            .qso-list-panel {
                width: 40%;
            }
            .qso-map-panel {
                width: 60%;
            }
            .qso-call { font-size: 16px; }
        }
        
        @media (max-width: 480px) {
            .modal-body-split { flex-direction: column; }
            .qso-list-panel { width: 100%; height: 40%; }
            .qso-map-panel { width: 100%; height: 60%; }
        }

        /* Animation for Legend/Badge */
        .shrink-anim {
            transform: scale(0.6) !important;
            transition: transform 300ms ease;
        }


        .qso-count-badge {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            color: var(--accent-cyan); /* 统一主题色 */
            font-weight: bold;
            font-size: 0.8rem;
            background: transparent;
            padding: 0 8px;
            height: 28px; /* 统一高度 */
            border-radius: 6px; /* 统一圆角 */
            border: 1px solid var(--border-color); /* 统一边框 */
            cursor: pointer; /* 可点击 */
            min-width: 40px; /* 保证最小宽度 */
            transition: all 0.2s ease;
        }
        .qso-count-badge:active {
            transform: scale(0.95);
            background: rgba(255, 255, 255, 0.1);
        }
        .qso-count-badge svg {
            width: 14px;
            height: 14px;
            fill: currentColor; /* 实心 */
            stroke: currentColor; /* 跟随文字颜色 */
            stroke-width: 2;
        }

        /* Station Modal - Bottom Sheet Style for iOS */
        .station-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 300;
            display: flex;
            justify-content: center;
            align-items: flex-end;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }
        .station-modal-overlay.show {
            opacity: 1;
            pointer-events: auto;
        }
        .station-modal-content {
            width: 100%;
            max-width: 600px;
            max-height: 80vh;
            background: var(--panel-bg);
            border-radius: 20px 20px 0 0;
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            transform: translateY(100%);
            transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
        }
        .station-modal-content .station-modal-header {
            flex-shrink: 0;
        }
        .station-modal-content .station-list-modal {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        .station-modal-overlay.show .station-modal-content {
            transform: translateY(0);
        }
        .station-modal-header {
            flex-shrink: 0;
            padding: 8px 15px;
            background: rgba(0, 0, 0, 0.2);
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
        }
        .station-drag-handle {
            width: 40px;
            height: 4px;
            background: rgba(255, 255, 255, 0.3);
            border-radius: 2px;
            margin: 8px auto 10px;
        }
        .station-modal-title {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: bold;
            font-size: 1rem;
            color: var(--text-main);
        }
        .station-modal-title span:last-child {
            color: var(--accent-cyan);
            background: rgba(255, 152, 0, 0.1);
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.85rem;
        }
        .station-list-modal {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 15px;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }
        .station-list-modal .station-item {
            touch-action: manipulation;
            padding: 6px;
            font-size: 0.75rem;
            min-height: 32px;
        }
        .station-list-modal .st-name {
            font-size: 0.75rem;
        }

        /* 小屏幕适配：改为2列 */
        @media (max-width: 480px) {
            .station-list-modal {
                grid-template-columns: repeat(2, 1fr);
                gap: 6px;
                padding: 10px;
            }
            .station-list-modal .station-item {
                padding: 5px;
                font-size: 0.7rem;
                min-height: 30px;
            }
            .station-list-modal .st-name {
                font-size: 0.7rem;
            }
        }

        /* Station Panel - Simplified to just show button */
        .station-panel {
            background: rgba(0,0,0,0.2);
            border-radius: var(--radius-md);
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .station-panel .station-header {
            font-size: 0.75rem;
            margin-bottom: 4px;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            color: var(--text-muted);
        }

    
/* Model Loader Styles */
.model-loader {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 360px;
    z-index: 60;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.model-loader.hidden {
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
}

.loader-content {
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid var(--accent-cyan);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15), inset 0 0 10px rgba(0, 243, 255, 0.05);
    text-align: center;
    backdrop-filter: blur(8px);
    position: relative;
}

/* Corner decorations for Sci-Fi look */
.loader-content::before,
.loader-content::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--accent-cyan);
    transition: all 0.3s ease;
}

.loader-content::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.loader-content::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.loader-text {
    color: var(--accent-cyan);
    font-family: 'Segoe UI', 'Roboto', monospace;
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 8px var(--accent-cyan);
    font-weight: bold;
}

.loader-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loader-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-cyan);
    box-shadow: 0 0 15px var(--accent-cyan);
    transition: width 0.1s linear;
    position: relative;
}

/* Glitch effect on bar */
.loader-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: loader-scan 1s infinite linear;
}

@keyframes loader-scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(500%); }
}

/* Error State */
.model-loader.error .loader-content {
    border-color: var(--accent-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.2);
}

.model-loader.error .loader-text {
    color: var(--accent-magenta);
    text-shadow: 0 0 8px var(--accent-magenta);
}

.model-loader.error .loader-bar-fill {
    background: var(--accent-magenta);
    box-shadow: 0 0 15px var(--accent-magenta);
}

.model-loader.error .loader-content::before,
.model-loader.error .loader-content::after {
    border-color: var(--accent-magenta);
}

/* Download Info Section */
.loader-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

.loader-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.loader-info span:first-child::before {
    content: '⬇';
    color: var(--accent-cyan);
    font-size: 10px;
}

.loader-info span:last-child::before {
    content: '⏱';
    color: var(--accent-magenta);
    font-size: 10px;
}

.model-loader.error .loader-info {
    display: none;
}
