:root {
  --bg-light: #f7f7f9;
  --bg-dark: #181818;
  --panel-light: #fff;
  --panel-dark: #232323;
  --text-light: #222;
  --text-dark: #f6f6f6;
  --subtext-light: #888;
  --subtext-dark: #bbb;
  --switch-off: #3a3a3a;
  --switch-on: #4caf50;
  --btn-bg: #fff;
  --btn-text: #222;
  --btn-bg-dark: #232323;
  --btn-text-dark: #fff;
  --border-radius: 20px;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-light);
  color: var(--text-light);
  font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans', Arial, sans-serif;
  transition: background 0.3s, color 0.3s;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
  overflow: hidden;
  /* 防止滚动条 */
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

/* 主容器垂直居中 */
.main-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 修改：上下居中 */
  gap: 18px;
  /* 容器间距 */
}

/* 时钟全屏时自适应放大，保持为屏幕最小边的正圆 */
#clockPanel:fullscreen .clock-canvas,
#clockPanel:-webkit-full-screen .clock-canvas {
  width: min(90vmin, 100vw);
  height: min(90vmin, 100vh);
}


.section {
  margin: 0 auto 18px auto;
  width: 96vw;
  max-width: 420px;
  border-radius: var(--border-radius);
  background: var(--panel-light);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  padding: 0;
  transition: background 0.3s;
  overflow: hidden;
  box-sizing: border-box;
}

body.dark .section {
  background: var(--panel-dark);
}

/* 顶部开关栏 */
.topbar {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  font-size: 1.09em;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: inherit;
}

.topbar .icon {
  margin-right: 10px;
  font-size: 1.3em;
  color: #bbb;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0);
  }

  100% {
    transform: rotate(360deg);
  }
}

.topbar-title {
  flex: 1;
  color: inherit;
  font-weight: 500;
}

/* 自定义开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  vertical-align: middle;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--switch-off);
  border-radius: 26px;
  transition: background 0.3s;
}

.switch input:checked+.slider {
  background: var(--switch-on);
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

.switch input:checked+.slider:before {
  transform: translateX(20px);
}

/* 时钟面板 */
.clock-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: 280px;
  position: relative;
  background: transparent;
}

.clock-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 0 18px;
}

.clock-canvas {
  width: 220px;
  height: 220px;
  background: transparent;
  display: block;
}

@media (max-width: 480px) {
  .clock-canvas {
    width: 170px;
    height: 170px;
  }

  .section {
    max-width: 98vw;
  }
}

/* 全屏按钮 */
.fullscreen-btn {
  position: absolute;
  top: 13px;
  right: 13px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 1.2em;
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
}

.fullscreen-btn:active {
  color: #fff;
}

/* 番茄计时器面板 */
.pomodoro-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 0 22px;
}

.pomodoro-title {
  font-size: 1.1em;
  color: var(--subtext-light);
  margin-bottom: 10px;
  letter-spacing: 2px;
  font-weight: 400;
}

body.dark .pomodoro-title {
  color: var(--subtext-dark);
}

.pomodoro-timer {
  font-size: 3.6em;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 18px;
  color: inherit;
}

.pomodoro-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 18px;
  padding: 8px 38px;
  font-size: 1.11em;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  transition: background 0.2s, color 0.2s;
}

body.dark .pomodoro-btn {
  background: var(--btn-bg-dark);
  color: var(--btn-text-dark);
  border: 1px solid #333;
}