:root {
    --background-color: #f5f5f5;
    --text-color: #0d1117;
}

[data-theme="dark"] {
    --background-color: #0d1117;
    --text-color: #f5f5f5;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    position: relative;
    padding-bottom: 70px;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

button {
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--text-color);
    color: var(--background-color);
}

.theme-switch button {/* 调整padding使按钮更紧凑 */
    border: none;
    border-radius: 30px;
    cursor: pointer;
    background-color: var(--background-color);
    color: var(--text-color);
    animation: breathing 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    /* 添加flex布局使SVG居中 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;      /* 设置固定宽度 */
    height: 40px;     /* 设置固定高度，保持按钮为正方形 */
}


/* 调整theme-switch整体布局 */
.theme-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;        /* 按钮和文字之间的间距 */
}

/* 呼吸灯动画关键帧 */
@keyframes breathing {
    0% {
        box-shadow: 0 0 10px var(--text-color);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px var(--text-color);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 10px var(--text-color);
        transform: scale(1);
    }
}

/* 悬停时可以选择暂停动画 */
.theme-switch button:hover {
    animation-play-state: paused;
}

#current-theme{
    font: 0.8rem sans-serif;
    font-weight: bold;
}

#create-timer-container{
    margin: 6rem 0;
}

.timer-container {
    /* display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; */
    margin: 0 auto;
    text-align: center;
    padding:50px 30px;
    border-radius: 2%;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    height: 400px;
    width: 300px;
}
.name-input{
    margin: 20px 0;
    font-size:0;
}
.name-input input{
    vertical-align: middle;
    padding:0;
    margin:0;
}
.name-input button{
    padding:5px 6px;
    margin:0 10px;
    vertical-align: middle;
    font-size: 1rem;
}
.name-input input{
    border: none;
    /* 可选的，移除焦点时边框颜色变化 */
    outline: none;
    font-size: 1.5rem;
   
}
.time-input {
    margin-bottom: 30px;
    font: 1.2em sans-serif;
    margin: 30px 0;
}
.timer-name {
    width: 150px;
    margin-bottom: 10px;
    font-size: 16px;
}
.controls button {
    margin: 5px;
    padding: 10px;
    font-size: 1em;
}
.timer-display {
    font-size: 2em;
    margin: 20px 0;
}
.timer-name-display{
    font-size: 1.5rem;
    font-weight: bold;
}
.progress-bar {
    width: 100%;
    height: 15px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 10px;
    display: none;
}
.progress {
    height: 100%; 
    width: 0%;
    background: #4CAF50;
    transition: width 1s linear;
    border-radius: 10px;
}
select {
    margin: 5px;
    padding: 8px 15px;
    font-size: 1rem;
    width: 80px;
    border: none;
    outline: none;
}
.controls button{
    cursor:pointer;
    border-radius: 15%;
}
.controls button svg{
    height: 20px;
    width: 20px;   
}
.footer {
    position: fixed;
    bottom: 50px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 50px;
    gap: 10px;
}
@media screen and (min-width:320px) and (max-width:360px){
    body{
    font-size: 12px;
    }
}
@media screen and (min-width:360px) and (max-width:390px){
    body{
        font-size: 13px;
    }
}
@media screen and (min-width:390px) and (max-width:460px){
    body{
        font-size: 14px;
    }
}

@media screen and (min-width:320px) and (max-width:460px){
    body{
        font-size: 12.5px;
    }
}
@keyframes rainbow-shadow {
    0% {
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);   /* 红 */
    }
    14% {
        box-shadow: 0 0 20px rgba(255, 127, 0, 0.5); /* 橙 */
    }
    28% {
        box-shadow: 0 0 20px rgba(255, 255, 0, 0.5); /* 黄 */
    }
    42% {
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);   /* 绿 */
    }
    56% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.5); /* 青 */
    }
    70% {
        box-shadow: 0 0 20px rgba(0, 0, 255, 0.5);   /* 蓝 */
    }
    84% {
        box-shadow: 0 0 20px rgba(139, 0, 255, 0.5); /* 紫 */
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);   /* 回到红色 */
    }
}

/* 背景 */
.timer-container {
    position: relative;
    /* background: var(--background-color); */
    background-color: rgba(104, 102, 102, 0.15);  /* 半透明白色背景 */
    backdrop-filter: blur(10px);  /* 磨砂效果 */
    -webkit-backdrop-filter: blur(10px);  /* Safari 兼容 */
    border: 1px solid rgba(0, 0, 0, 0.2);  /* 微妙的边框 */
    
    overflow: hidden;
    animation: rainbow-shadow 10s linear infinite;
}
/* 为暗色主题添加对应的磨砂效果 */
[data-theme="dark"] .timer-container {
    background-color: rgba(0, 0, 0, 0.15);  /* 半透明黑色背景 */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes gradientBG {
    0% {background-position: 0% 50%;}
    50% {background-position: 100% 50%;}
    100% {background-position: 0% 50%;}
}
/* 电量背景 */
.battery-background {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(70, 219, 70, 0.9);  /* 半透明的绿色背景 */
    transition: height 1s linear;
    z-index: -1;  /* 确保背景在内容后面 */
}
/* 电量低时变为红色 */
/* .battery-background.battery-low {
    background-color: rgba(255, 0, 0, 0.2);  
} */

/* 低电量样式 */
.battery-low {
    background: linear-gradient(to top, #ff4444, #ff4444);
}


/* 电量警告动画 */
@keyframes batteryWarning {
    0% { border-color: var(--text-color); }
    50% { border-color: #ff4444; }
    100% { border-color: var(--text-color); }
}

.battery-warning {
    animation: batteryWarning 1s infinite;
    border: 3px solid #ff4444;
}

#create-timer {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 1.2em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
#create-timer button{
    margin: 30px 0 10px 0;
}
#timers-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.timer-container {
    width: 300px;
    margin: 10px;
    padding: 15px;
    border-radius: 10px;
}

.delete {
    background-color: #ff4444;
    color: white;
}

a {
    color: #6eb5ff;  /* 浅蓝色 */
    text-decoration: none;  /* 移除下划线 */
    transition: color 0.3s ease;  /* 添加颜色过渡效果 */
}

/* 鼠标悬停效果 */
a:hover {
    color: #3498db;  /* 悬停时颜色加深 */
}

/* 暗色主题下的链接颜色 */
[data-theme="dark"] a {
    color: #87cefa;  /* 暗色主题下使用更亮的浅蓝色 */
}

[data-theme="dark"] a:hover {
    color: #00bfff;  /* 暗色主题下悬停颜色 */
}

/* 二维码容器 */
.qrcode-container {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* 二维码项 */
.qrcode-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 10px;
}

.qrcode-item img {
    width: 180px;
    height: 180px;
    margin-bottom: 5px;  /* 图片和文字之间的间距 */
}


.qrcode-item span {
    font-size: 14px;
    color: #333;
}

/* 容器改为flex布局 */
.qrcode-wrapper {
    display: flex;
    flex-direction: row;
}

/* 显示二维码的类 */
.show-qrcode {
    display: flex !important;
}

canvas#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

/* 为了确保其他内容可见，给主容器添加一些背景色 */
#create-timer-container, 
.timer-container {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    padding: 20px;
    margin: 20px;
}

[data-theme='dark'] #create-timer-container,
[data-theme='dark'] .timer-container {
    background-color: rgba(30, 30, 30, 0.2);
}