* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-color-1: #1a1a2e;
  --bg-color-2: #16213e;
  --accent-color: #6c63ff;
  --accent-glow: rgba(108, 99, 255, 0.4);
  --text-color: #e8e8f0;
  --text-muted: #8888a0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, var(--bg-color-1), var(--bg-color-2));
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 0;
  transition: background 1s ease;
}

@keyframes bgShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 480px;
  padding: 0 20px;
}

.site-title {
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 5px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
  transition: color 0.5s ease;
}

/* 关键：用 aspect-ratio 保证圆环容器始终是正方形 */
.timer-wrapper {
  position: relative;
  width: 320px;
  height: 320px;
  max-width: 80vw;
  max-height: 80vw;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ringCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.time-display {
  position: relative;
  z-index: 2;
  font-size: 56px;
  font-weight: 200;
  letter-spacing: 4px;
  color: var(--text-color);
  text-shadow: 0 0 20px var(--accent-glow);
  transition: color 0.5s ease;
  user-select: none;
}

.status-text {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 2px;
  transition: color 0.5s ease;
}

.controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 12px 32px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover:not(:disabled) {
  color: var(--text-color);
  border-color: var(--text-color);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stats {
  display: flex;
  gap: 32px;
  font-size: 13px;
  color: var(--text-muted);
}

.stats strong {
  color: var(--accent-color);
  font-weight: 500;
}

.settings-link {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-link a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 1px;
  transition: color 0.3s ease;
}

.settings-link a:hover {
  color: var(--accent-color);
}

.settings-link .divider {
  color: var(--text-muted);
  opacity: 0.4;
}

body.focus-mode {
  --bg-color-1: #0f0f1a;
  --bg-color-2: #1a1a2e;
  --accent-color: #6c63ff;
  --accent-glow: rgba(108, 99, 255, 0.4);
}

body.break-mode {
  --bg-color-1: #1a2e1a;
  --bg-color-2: #162e21;
  --accent-color: #4ade80;
  --accent-glow: rgba(74, 222, 128, 0.4);
}

/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
  .container {
    gap: 16px;
    padding: 0 16px;
  }

  .site-title {
    font-size: 13px;
    letter-spacing: 3px;
  }

  .timer-wrapper {
    width: 260px;
    height: 260px;
  }

  .time-display {
    font-size: 42px;
    letter-spacing: 2px;
  }

  .status-text {
    font-size: 13px;
  }

  .btn {
    padding: 10px 22px;
    font-size: 14px;
  }

  .stats {
    gap: 20px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .timer-wrapper {
    width: 220px;
    height: 220px;
  }

  .time-display {
    font-size: 36px;
  }

  .btn {
    padding: 8px 18px;
    font-size: 13px;
  }
}