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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    transition: background-color 0.3s ease;
    min-height: 100vh;
    background-color: #ffffff;
}

/* 控制栏基础样式 */
.control-panel {
    position: fixed;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* 控制栏内容 */
.control-content {
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* 不同位置的控制栏 */
.control-panel.top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90vw;
}

.control-panel.right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    flex-direction: column;
}

.control-panel.right .control-content {
    flex-direction: column;
    align-items: stretch;
}

.control-panel.bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90vw;
}

.control-panel.left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    flex-direction: column;
}

.control-panel.left .control-content {
    flex-direction: column;
    align-items: stretch;
}

/* 控制栏隐藏状态 */
.control-panel.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 控制区域 */
.control-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 组合控制区域（位置和语言） */
.combined-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    flex-wrap: wrap;
}

/* 位置按钮调整 */
.position-buttons .position-btn {
    padding: 6px 10px;
    font-size: 16px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 控制按钮 */
.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

/* 图标样式 */
.icon {
    font-size: 16px;
}

/* 颜色选择器 */
.color-input {
    width: 40px;
    height: 36px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    transition: all 0.2s ease;
}

.color-hex-display {
    display: inline-block;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    min-width: 70px;
    text-align: center;
}

/* 深色背景下的样式 */
body.dark-bg .color-hex-display {
    background-color: rgba(50, 50, 50, 0.9);
    color: #fff;
}

.color-input:hover {
    border-color: #adb5bd;
    transform: scale(1.05);
}

/* 位置按钮容器 */
.position-buttons {
    display: flex;
    gap: 4px;
    background-color: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
}

/* 位置按钮 */
.position-btn {
    padding: 6px 12px;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
}

.position-btn:hover {
    background-color: #e9ecef;
}

.position-btn.active {
    background-color: #007bff;
    color: white;
}

/* 语言选择器 */
.language-select {
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
    text-align: center;
}

.language-select:hover {
    border-color: #adb5bd;
    background-color: #e9ecef;
}

.language-select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-color: #007bff;
}

/* 深色模式下的语言选择器样式 */
body.dark-bg .language-select {
    background-color: rgba(50, 50, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e9ecef;
}

/* 闪烁控制区域样式 */
.blink-section {
    /* margin-top: 16px;
    padding-top: 16px; */
    border-top: 1px solid #eee;
    width: 100%;
}

/* 闪烁开关按钮样式 */
.blink-toggle-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.blink-toggle-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.blink-toggle-btn.active {
    background: linear-gradient(135deg, #ff4d4d, #cc0000);
}

.blink-toggle-btn.active:hover {
    background: linear-gradient(135deg, #e60000, #b30000);
}

.blink-toggle-btn .icon {
    font-size: 16px;
}

/* 滑块组容器 */
.slider-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

/* 单个滑块项 */
.slider-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 标签和值在同一行 */
.slider-label-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.slider-label-value label {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

/* 兼容旧样式 */
.slider-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-container label {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

/* 滑块样式 */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
}

/* 频率滑块容器样式 */
#blink-frequency {
    margin-bottom: 15px;
}

/* 滑块容器样式 */
.slider-container {
    position: relative;
}

/* 滑块轨道样式 */
input[type="range"]::-webkit-slider-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
}

/* 滑块拇指样式 */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

/* Firefox 滑块样式 */
input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 滑块值显示 */
.slider-value {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-align: right;
}

/* 深色模式下的闪烁控制样式 */
body.dark-bg .blink-section {
    border-top-color: #444;
}

body.dark-bg .blink-toggle-btn {
    background: linear-gradient(135deg, #5cb85c, #4cae4c);
}

body.dark-bg .blink-toggle-btn:hover {
    background: linear-gradient(135deg, #4cae4c, #449d44);
}

body.dark-bg .slider-container label,
body.dark-bg .slider-label-value label {
    color: #ccc;
}

body.dark-bg input[type="range"] {
    background: #555;
}

body.dark-bg input[type="range"]::-webkit-slider-track {
    background: #555;
}

body.dark-bg input[type="range"]::-webkit-slider-thumb {
    background: #5cb85c;
}

body.dark-bg input[type="range"]::-webkit-slider-thumb:hover {
    background: #4cae4c;
}

body.dark-bg input[type="range"]::-moz-range-track {
    background: #555;
}

body.dark-bg input[type="range"]::-moz-range-thumb {
    background: #5cb85c;
}

body.dark-bg input[type="range"]::-moz-range-thumb:hover {
    background: #4cae4c;
}

body.dark-bg .slider-value {
    color: #aaa;
}

body.dark-bg .language-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(70, 70, 70, 0.8);
}

body.dark-bg .language-select:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}


/* 滑块容器 */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* 滑块标签 */
.slider-label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 4px;
}

body.dark-bg .slider-label {
    color: #e9ecef;
}

/* 滑块 */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    transition: background 0.2s;
}

.slider:hover {
    background: #d0d0d0;
}

/* 滑块轨道 */
.slider::-webkit-slider-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    cursor: pointer;
}

/* 滑块拇指 */
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

/* Firefox 滑块样式 */
.slider::-moz-range-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    cursor: pointer;
    border: none;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* 滑块值显示 */
.slider-value {
    font-size: 14px;
    font-weight: 600;
    color: #007bff;
    text-align: right;
}

body.dark-bg .slider-value {
    color: #4dabf7;
}

/* 深色模式下的滑块样式 */
body.dark-bg .slider {
    background: #444;
}

body.dark-bg .slider:hover {
    background: #555;
}

body.dark-bg .slider::-webkit-slider-track {
    background: #444;
}

body.dark-bg .slider::-moz-range-track {
    background: #444;
}

body.dark-bg .slider::-webkit-slider-thumb {
    background: #4dabf7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

body.dark-bg .slider::-moz-range-thumb {
    background: #4dabf7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* 控制标签 */
.control-label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

/* 显示控制栏按钮 */
.show-panel-btn {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.show-panel-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.show-panel-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 暗色模式支持（根据背景色自动调整） */
body.dark-bg .control-panel {
    background-color: rgba(30, 30, 30, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-bg .control-btn {
    background-color: rgba(50, 50, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e9ecef;
}

body.dark-bg .control-btn:hover {
    background-color: rgba(70, 70, 70, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-bg .control-label {
    color: #e9ecef;
}

body.dark-bg .position-buttons {
    background-color: rgba(50, 50, 50, 0.8);
}

body.dark-bg .position-btn {
    color: #adb5bd;
}

body.dark-bg .position-btn:hover {
    background-color: rgba(70, 70, 70, 0.8);
}

body.dark-bg .show-panel-btn {
    background-color: rgba(30, 30, 30, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .control-panel.top,
    .control-panel.bottom {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }
    
    .control-panel.right,
    .control-panel.left {
        top: 10px;
        bottom: 10px;
        transform: none;
    }
    
    .control-section {
        justify-content: center;
    }
}

/* 辅助功能 */
.control-btn:focus,
.position-btn:focus,
.show-panel-btn:focus,
.color-input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* 顶部控件组 - 取色和隐藏控制栏按钮并排 */
.top-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* 在左右两侧控制栏中调整top-controls布局 */
.control-panel.right .top-controls,
.control-panel.left .top-controls {
    justify-content: center;
}

/* 颜色控制区域 */
.color-controls {
    display: flex;
    flex-direction: column;
    /* gap: 12px; */
    align-items: center;
    width: 100%;
}

/* 取色器部分 */
.color-picker-section {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* 快速色盘容器 */
.quick-colors-container {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 12px;
    box-sizing: border-box;
}

/* 快速色盘网格 */
.quick-colors-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    justify-content: center;
}

/* 颜色块 */
.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.color-swatch:active {
    transform: scale(0.95);
}

/* 深色模式下的颜色块样式 */
body.dark-bg .quick-colors-container {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-bg .color-swatch {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-bg .color-swatch:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .quick-colors-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 4px;
    }
    
    .color-swatch {
        width: 18px;
        height: 18px;
    }
    
    .quick-colors-container {
        padding: 8px;
    }
}

/* 控制栏不同方向的调整 */
.control-panel.right .quick-colors-grid,
.control-panel.left .quick-colors-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* 优化blink-section布局 */
.blink-section {
    width: 100%;
}

/* 当屏幕较宽且控制栏在底部和顶部时，blink-toggle和slider并排显示 */
@media (min-width: 768px) {
    .control-panel.top .blink-section,
    .control-panel.bottom .blink-section {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 16px;
        flex-wrap: wrap;
    }
    
    .control-panel.top .blink-toggle-btn,
    .control-panel.bottom .blink-toggle-btn {
        width: auto;
        min-width: 140px;
    }
    
    .control-panel.top .slider-group,
    .control-panel.bottom .slider-group {
        display: flex;
        flex-direction: row;
        gap: 16px;
        width: auto;
        max-width: none;
    }
    
    .control-panel.top .slider-item,
    .control-panel.bottom .slider-item {
        min-width: 150px;
    }
}

/* 控制栏在左右侧或屏幕较窄时，保持竖排布局 */
.control-panel.right .blink-section,
.control-panel.left .blink-section,
@media (max-width: 767px) {
    .control-panel.top .blink-section,
    .control-panel.bottom .blink-section {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .control-panel.top .blink-toggle-btn,
    .control-panel.bottom .blink-toggle-btn {
        width: 100%;
    }
    
    .control-panel.top .slider-group,
    .control-panel.bottom .slider-group {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

/* 确保颜色控制区域在不同方向都能良好显示 */
.control-panel.right .color-controls,
.control-panel.left .color-controls {
    align-items: stretch;
}

.control-panel.right .color-picker-section,
.control-panel.left .color-picker-section {
    justify-content: center;
}

/* 减少动画对性能的影响 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}