@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap');

* {
    box-sizing: border-box;
}

body, .container {
    display: grid;
    place-items: center;

    width: 100%;
    margin: 0;
    padding: 1rem;
  display: flex;
  align-items: center;
  height: 100vh; /* 设置容器高度为视口高度 */ 
    justify-content: center; /* 设置子元素水平居中 */
}

.timer {
    font-size: 16px;
    font-family: sans-serif;
    background: #e8e8e8;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    font-family: "Roboto Mono", monospace;
    width: 100%;
    max-width: 300px;
    box-shadow: 0px 0px 10px #00000088, 3px 3px 10px #00000088;
      display: flex;
  align-items: center;
  flex-direction: column; /* 使子元素垂直排列 */
}

.timer h2 {
    margin-top: 0;
}

.timer .label {
    margin: 0.5rem auto;
}

.timer input {
    display: block;
    max-width: 100%;
    text-align: center;
    font-family: inherit;
    border: 2px solid #aaa;
    border-radius: 12px;
    padding: 0.1em 0.25em;
    background: #efefef;
}

.timer #time {
    font-size: 48px;
    margin-bottom: 0.5rem;
}

.timer #restTime {
    font-size: 20px;
    margin-bottom: 0.5rem;
}

.timer button {
    background: #383538;
    color: #fafafa;
    border: 1px solid #fff;
    padding: 0.5em 1em;
    border-radius: 5px;
    font-size: 1rem;
    letter-spacing: 1px;
    transition: 0.35s all ease-out;
    width: 100%;
}

.timer:has(:invalid) button {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.timer button span {
    pointer-events: none;
}

.timer[data-active="true"] #startpause span:first-child,
.timer[data-active="false"] #startpause span:last-child {
    display: none;
}

.timer[data-active="true"] #time,
.timer[data-rest="true"] #restTime {
    border-color: #3cd070;
}

.timer[data-rest="true"] #time {
    border-color: #ffba00;
}

.timer button:hover,
.timer button:focus {
    background: #585558;
}

.timer button:active {
    scale: 0.95;
}

body {
    background-image: url(bg3.jpg);
    background-size: cover;
    background-position: center;
}