/* 设置body元素的样式，包括背景色、文字颜色、字体、布局方式等 */
body {
    background-color: #121212;
    color: #ffcccc; /* 提高对比度 */
    font-family: 'Arial Black', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 100vh;
    margin: 0;
    padding: 20px;
}

/* 设置容器的样式，包括文本对齐、背景色、内边距、圆角、阴影等 */
.container {
    text-align: center;
    background-color: rgba(255, 192, 203, 0.1);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(255, 192, 203, 0.5);
    width: 90%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

/* 设置瓦片元素的样式，包括内外边距、背景色、圆角、阴影等 */
.tile {
    margin: 20px 0;
    padding: 20px;
    background-color: rgba(255, 192, 203, 0.2);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 192, 203, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* 设置数字输入框的样式，包括内外边距、字体大小、边框、背景色等 */
input[type="number"] {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #ffcccc; /* 提高对比度 */
    border-radius: 5px;
    background-color: black;
    color: #ffcccc; /* 提高对比度 */
    margin: 5px;
    width: 100%;
    max-width: 200px;
    transition: border-color 0.3s;
}

input[type="number"]:focus {
    border-color: #ff69b4;
}

/* 设置按钮的样式，包括内外边距、字体大小、边框、背景色等 */
button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    background-color: pink;
    color: black;
    cursor: pointer;
    margin: 5px;
    transition: background-color 0.3s, transform 0.2s;
    width: 100%;
    max-width: 200px;
}

/* 设置按钮悬停时的样式，改变背景色 */
button:hover {
    background-color: #ff69b4;
    transform: scale(1.05);
}

/* 设置结果展示元素的样式，包括上边距、字体大小、粗细 */
#result {
    margin-top: 20px;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 设置倒计时元素的样式，包括上边距、字体大小、粗细、动画效果 */
#timer {
    margin-top: 20px;
    font-size: 24px;
    font-weight: bold;
    animation: countdownAnimation 1s infinite;
}

/* 设置结果容器的样式，包括上边距 */
.result-container {
    margin-top: 20px;
}

/* 设置倒计时容器的样式，包括上边距 */
.timer-container {
    margin-top: 20px;
}

/* 设置覆盖层的样式，包括定位、尺寸、背景色、布局方式等 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,0,0,0.8), rgba(0,0,0,0.9));
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
}

/* 设置可见状态的覆盖层样式，改变可见性和不透明度 */
.overlay.visible {
    visibility: visible;
    opacity: 1;
}

/* 定义一个覆盖整个视口的半透明层样式 */
.popup {
    font-size: 150px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 20px red;
    animation: flash 1s infinite alternate;
    text-align: center;
    width: 100%; /* 调整宽度 */
    height: 150px;
}

/* 定义倒计时动画的帧，改变背景色 */
@keyframes countdownAnimation {
    0%, 100% {
        background-color: rgba(255, 192, 203, 0.2);
    }
    50% {
        background-color: rgba(255, 192, 203, 0.5);
    }
}

/* 定义旋转和缩放动画的帧，改变变换属性和不透明度 */
@keyframes rotateAndScale {
    0% {
        transform: rotate(0deg) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: rotate(180deg) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

/* 定义一个名为flash的动画关键帧 */
@keyframes flash {
    from { transform: scale(1); } /* 使用transform替代opacity */
    to { transform: scale(0.9); } /* 使用transform替代opacity */
}

/* 设置h1元素的样式 */
h1 {
    text-align: center;
    margin-top: 0;
    font-size: 2em;
    color: #ffcccc;
    font-weight: bold;
}

/* 设置滚动数字样式 */
.rolling-number {
    font-size: 24px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 192, 203, 0.2);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 192, 203, 0.5);
    margin: 5px;
    animation: rotateAndScale 2s infinite;
}

/* 添加滚动动画 */
.rolling-number.rolling {
    animation: rotateAndScale 2s infinite;
}

/* 添加选中样式 */
.rolling-number.selected {
    animation: none;
    background-color: rgba(255, 192, 203, 0.5);
    box-shadow: 0 0 20px rgba(255, 192, 203, 0.8);
}

/* 设置旋转动画 */
.spin {
    animation: spin 0.5s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 快捷时间按钮和自定义时间输入框的布局 */
.timer-settings {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

/* 倒计时显示的布局 */
.timer-display {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

/* 控制按钮的布局 */
.timer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 调整快捷时间按钮的样式 */
.timer-settings button {
    width: 60px;
    padding: 10px;
    font-size: 14px;
}

/* 调整自定义时间输入框的样式 */
.timer-settings input[type="number"] {
    width: 100px;
    padding: 10px;
    font-size: 14px;
}

/* 调整控制按钮的样式 */
.timer-controls button {
    width: 80px;
    padding: 10px;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        width: 100%;
        padding: 20px;
    }

    .tile {
        padding: 15px;
    }

    input[type="number"] {
        font-size: 14px;
    }

    button {
        font-size: 14px;
    }

    h1 {
        font-size: 1.8em;
    }

    .rolling-number {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .timer-settings button {
        width: 50px;
        padding: 8px;
        font-size: 12px;
    }

    .timer-settings input[type="number"] {
        width: 80px;
        padding: 8px;
        font-size: 12px;
    }

    .timer-controls button {
        width: 70px;
        padding: 8px;
        font-size: 12px;
    }
}