* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 50%, #16213e 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
    transition: background-color 0.3s ease;
}

/* 闪烁时的背景效果 */
body.blinking {
    animation: backgroundBlink 1s infinite;
}

@keyframes backgroundBlink {
    0%, 100% { 
        background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 50%, #16213e 100%); 
    }
    50% { 
        background: linear-gradient(135deg, #2f2f2f 0%, #3a3a4e 50%, #36365e 100%); 
    }
}

/* 整体边框容器 */
.border-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 边框基础样式 */
.border {
    position: absolute;
    background: #000;
    z-index: 100;
    overflow: hidden;
}

/* 上边框 */
.top-border {
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
}

/* 右边框 */
.right-border {
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
}

/* 下边框 */
.bottom-border {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
}

/* 左边框 */
.left-border {
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
}

/* 流动灯光段 */
.light-segment {
    position: absolute;
    width: 30px;
    height: 8px;
    background: currentColor;
    border-radius: 4px;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    opacity: 0;
}

/* 垂直边框的灯光段 */
.right-border .light-segment,
.left-border .light-segment {
    width: 8px;
    height: 30px;
}

/* 流动动画 */
@keyframes topFlow {
    0% {
        left: -30px;
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

@keyframes rightFlow {
    0% {
        top: -30px;
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes bottomFlow {
    0% {
        right: -30px;
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        right: 100%;
        opacity: 0;
    }
}

@keyframes leftFlow {
    0% {
        bottom: -30px;
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        bottom: 100%;
        opacity: 0;
    }
}

/* 闪烁动画 */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 呼吸动画 */
@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* 音乐律动闪烁效果 */
.music-blinking .border {
    animation: musicBlink 1s linear infinite;
}

@keyframes musicBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* 内容区域 */
.content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 20px;
    max-width: 90%;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.9) 0%, rgba(20, 20, 30, 0.9) 100%);
    border-radius: 20px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 -1px 0 rgba(0, 0, 0, 0.5) inset;
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* 高度自适应 */
    max-height: 90vh;
    overflow-y: auto;
}

/* 标题和语言选择器容器 */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

h1 {
    font-size: 1.7rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(90deg, #fff, #a0a0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    letter-spacing: 0.5px;
    flex-grow: 1;
    text-align: left;
}

/* 语言选择器 */
.language-selector {
    margin-left: 15px;
}

.language-select {
    background: rgba(40, 40, 50, 0.9);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    min-width: 140px;
}

/* 控制键盘 */
.control-keyboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(7, auto);
    gap: 15px;
    width: 100%;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(50, 50, 60, 0.9), rgba(35, 35, 45, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 -1px 0 rgba(0, 0, 0, 0.5) inset;
    position: relative;
    overflow: hidden;
}

.btn-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-status {
    font-size: 0.8rem;
    color: #aaa;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.on-off {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 8px 0;
}

.on-btn, .off-btn {
    width: 45%;
    height: 55px;
    border-radius: 12px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
    transition: all 0.3s ease;
}

.on-btn {
    background: linear-gradient(145deg, rgba(0, 150, 0, 0.8), rgba(0, 100, 0, 0.8));
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.off-btn {
    background: linear-gradient(145deg, rgba(150, 0, 0, 0.8), rgba(100, 0, 0, 0.8));
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.on-btn.active {
    background: linear-gradient(145deg, rgba(0, 200, 0, 0.9), rgba(0, 150, 0, 0.9));
    box-shadow: 
        0 0 15px rgba(0, 255, 0, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.off-btn.active {
    background: linear-gradient(145deg, rgba(200, 0, 0, 0.9), rgba(150, 0, 0, 0.9));
    box-shadow: 
        0 0 15px rgba(255, 0, 0, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.color-mode {
    grid-column: 1 / 3;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.color-option {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.color-option.active {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 
        0 0 15px currentColor,
        0 3px 10px rgba(0, 0, 0, 0.4);
}

.color-red { background: #ff0000; }
.color-blue { background: #0000ff; }
.color-green { background: #00ff00; }
.color-gold { background: #ffd700; }
.color-sky-blue { background: #87CEEB; }
.color-mixed { 
    background: linear-gradient(45deg, 
        #ff0000, #0000ff, #00ff00, #ffd700, #87CEEB); 
}

.mode-selector {
    grid-column: 1 / 3;
}

.mode-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.mode-option {
    padding: 8px 14px;
    background: linear-gradient(145deg, rgba(60, 60, 70, 0.9), rgba(40, 40, 50, 0.9));
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-option.active {
    background: linear-gradient(145deg, rgba(80, 80, 200, 0.9), rgba(60, 60, 180, 0.9));
    box-shadow: 
        0 0 10px rgba(100, 100, 255, 0.5),
        0 3px 8px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.special-modes {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.special-mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.special-mode-option {
    padding: 8px 10px;
    background: linear-gradient(145deg, rgba(80, 80, 80, 0.9), rgba(60, 60, 60, 0.9)); /* 修改为灰色 */
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.special-mode-option.active {
    background: linear-gradient(145deg, rgba(120, 120, 120, 0.9), rgba(100, 100, 100, 0.9)); /* 修改为激活时的灰色 */
    box-shadow: 
        0 0 10px rgba(200, 200, 200, 0.5),
        0 3px 8px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.special-mode-option.needs-permission {
    background: linear-gradient(145deg, rgba(80, 80, 80, 0.9), rgba(60, 60, 60, 0.9)); /* 修改为灰色 */
}

.special-mode-option.needs-permission.active {
    background: linear-gradient(145deg, rgba(120, 120, 120, 0.9), rgba(100, 100, 100, 0.9)); /* 修改为激活时的灰色 */
    box-shadow: 
        0 0 10px rgba(200, 200, 200, 0.5),
        0 3px 8px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

/* 数据监控区域 */
.data-monitor {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 5px;
}

.monitor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(30, 30, 40, 0.7);
    border-radius: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
}

.monitor-label {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 5px;
}

.volume-display {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.volume-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff00, #ffff00, #ff0000);
    transition: width 0.1s ease;
}

.color-preview {
    width: 100%;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.speed-control, .brightness-control {
    grid-column: 1 / 3;
}

.slider-container {
    width: 100%;
    margin-top: 8px;
    position: relative;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #333, #555);
    outline: none;
    box-shadow: 
        0 2px 5px rgba(0, 0, 0, 0.3) inset,
        0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, #aaa, #888);
    cursor: pointer;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.2) inset;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.slider-with-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.slider-label {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.slider-status {
    font-size: 0.8rem;
    color: #aaa;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.email-footer {
    margin-top: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}