* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100%;
  min-height: 100vh; /* 使用 min-height 以获得更好的响应性 */

  /* --- 背景图片设置 开始 --- */
  /* 如果图片加载失败，显示的后备颜色 */
  background-color: #e0e0e0; /* 一个中性的灰色后备 */
  /* 设置必应图片 API URL */
  /* 注意：{$area} 可能需要替换为具体的区域代码，例如 US, CN, DE 等 */
  background-image: url('https://www.todaybing.com/api/today/{$area}');
  /* 确保图片覆盖整个视口 */
  background-size: cover;
  /* 居中图片 */
  background-position: center center;
  /* 防止图片重复 */
  background-repeat: no-repeat;
  /* 固定背景图片，使其不随内容滚动 */
  background-attachment: fixed;
  /* --- 背景图片设置 结束 --- */

  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0; /* 为较小的视口添加一些内边距 */
  font-family: "Montserrat", sans-serif; /* 添加了 sans-serif 后备字体 */
}

button {
  border: 0;
  outline: 0;
  cursor: pointer; /* 为所有按钮添加指针手势 */
}

.container {
  margin: 40px 0;
  width: 400px;
  max-width: 95%; /* 确保在小屏幕上能适应 */
  /* height: 600px; /* 移除固定高度，让内容决定高度 */
  padding: 20px 25px; /* 轻微调整内边距 */
  /* 容器背景 - 使用浅灰色，以便内容在复杂背景图下仍可读 */
  background: rgba(248, 249, 250, 0.95); /* 浅灰色，带一点透明度 */
  backdrop-filter: blur(5px); /* 添加毛玻璃效果（可选，增加现代感） */
  -webkit-backdrop-filter: blur(5px); /* Safari 兼容 */
  border-radius: 10px;
  /* 调整阴影以适应浅色容器 */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 0 6px 20px rgba(0, 0, 0, 0.08);
  font-family: "Montserrat", sans-serif; /* 继承或再次指定字体 */
}

.container h2.title {
  font-size: 1.75rem;
  margin: 10px 0; /* 调整了外边距 */
  margin-bottom: 30px;
  /* 标题颜色 - 深灰色 */
  color: #343a40;
  text-align: center; /* 居中标题 */
}

.result {
  position: relative;
  width: 100%;
  height: 65px;
  overflow: hidden; /* 保持隐藏以实现复制按钮动画 */
  margin-bottom: 15px; /* 在下方添加一些空间 */
}

.result__info {
  position: absolute;
  bottom: 4px;
  /* 提示信息颜色 - 中灰色 */
  color: #6c757d;
  font-size: 0.8rem;
  transition: all 150ms ease-in-out;
  transform: translateY(200%);
  opacity: 0;
}

.result__info.right {
  right: 8px;
}

.result__info.left {
  left: 8px;
}

.result__viewbox {
  width: 100%;
  height: 100%;
  /* 结果显示框背景 - 白色带边框 */
  background: #ffffff;
  border: 1px solid #dee2e6; /* 浅色边框 */
  border-radius: 8px;
  /* 文本颜色 - 深色 */
  color: #212529;
  text-align: center;
  line-height: 65px;
  font-size: 1.1rem; /* 稍大的文本 */
  font-weight: 500;
}

.result #copy-btn {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 38px;
  height: 38px;
  /* 复制按钮背景 - 中灰色 */
  background: #6c757d;
  color: #ffffff; /* 按钮上的图标/文字颜色 */
  display: flex; /* 用于居中图标（如果添加了） */
  justify-content: center; /* 用于居中图标 */
  align-items: center; /* 用于居中图标 */
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: all 350ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  z-index: 2;
  /* 如果需要，可以添加内容，例如 SVG 图标 */
  /* content: 'Copy'; /* 或者使用图标字体/SVG */
}

.result #copy-btn:active {
  /* 调整涟漪效果以适应浅色背景 */
  box-shadow: 0 0 0 200px rgba(0, 0, 0, 0.05);
}

.result:hover #copy-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.35);
}

.field-title {
  position: absolute;
  top: -10px;
  left: 8px;
  transform: translateY(-50%);
  font-weight: 800;
  /* 字段标题颜色 - 中灰色 */
  color: #6c757d;
  text-transform: uppercase;
  font-size: 0.65rem;
  pointer-events: none;
  user-select: none;
  /* 背景色匹配容器背景，以干净地覆盖边框 */
  background-color: rgba(248, 249, 250, 0.95); /* 匹配容器背景色和透明度 */
  padding: 0 4px; /* 添加内边距，使文本不接触边框 */
}

.options {
  width: 100%;
  height: auto;
  margin: 50px 0;
}

.range__slider {
  position: relative;
  width: 100%;
  height: calc(65px - 10px);
  display: flex;
  justify-content: center;
  align-items: center;
  /* 滑块区域背景 - 稍深的灰色 */
  background: #e9ecef;
  border: 1px solid #dee2e6; /* 浅色边框 */
  border-radius: 8px;
  margin: 30px 0;
}

.range__slider::before,
.range__slider::after {
  position: absolute;
  /* 最小值/最大值文本颜色 - 深灰色 */
  color: #495057;
  font-size: 0.9rem;
  font-weight: bold;
}

.range__slider::before {
  content: attr(data-min);
  left: 10px;
}

.range__slider::after {
  content: attr(data-max);
  right: 10px;
}

.range__slider .length__title::after {
  content: attr(data-length);
  position: absolute;
  right: -16px;
  font-variant-numeric: tabular-nums;
  /* 长度数字颜色 - 深灰色 */
  color: #495057;
}

#slider {
  -webkit-appearance: none;
  appearance: none; /* 添加标准属性 */
  width: calc(100% - (70px));
  height: 4px; /* 稍粗一点 */
  border-radius: 5px;
  /* 滑块轨道背景 - 中灰色 */
  background: #ced4da;
  outline: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

#slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  /* 滑块按钮背景 - 使用主题色 */
  background: #667eea;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
#slider::-webkit-slider-thumb:hover {
  /* 悬停时加深滑块按钮颜色 */
  background: #5a6fde;
  transform: scale(1.2);
}
#slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
   /* 滑块按钮背景 - 使用主题色 */
  background: #667eea;
  cursor: pointer;
  transition: background 0.15s ease-in-out;
}
#slider::-moz-range-thumb:hover {
   /* 悬停时加深滑块按钮颜色 */
  background: #5a6fde;
}

.settings {
  position: relative;
  height: auto;
  width: 100%; /* 修正了之前的拼写错误 widows -> width */
  display: flex;
  flex-direction: column;
}

.settings .setting {
  position: relative;
  width: 100%;
  height: calc(65px - 10px);
   /* 设置项背景 - 稍深的灰色 */
  background: #e9ecef;
  border: 1px solid #dee2e6; /* 浅色边框 */
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 10px 25px;
  /* 设置项文本颜色 - 深灰色 */
  color: #343a40;
  margin-bottom: 8px;
}

.settings .setting input {
  opacity: 0;
  position: absolute;
}

.settings .setting input + label {
  user-select: none;
  width: 100%; /* 确保标签占据全部宽度以便点击 */
  cursor: pointer; /* 使标签看起来可点击 */
}

.settings .setting input + label::before,
.settings .setting input + label::after {
  content: "";
  position: absolute;
  transition: 150ms cubic-bezier(0.24, 0, 0.5, 1);
  transform: translateY(-50%);
  top: 50%;
  right: 10px;
  cursor: pointer;
}

/* 开关轨道 (关闭状态) */
.settings .setting input + label::before {
  height: 30px;
  width: 50px;
  border-radius: 30px;
  /* 关闭状态轨道背景 - 中浅灰色 */
  background: #adb5bd;
}

/* 开关把手 (关闭状态) */
.settings .setting input + label::after {
  height: 24px;
  width: 24px;
  border-radius: 60px;
  right: 32px;
   /* 关闭状态把手背景 - 浅灰色，比轨道稍浅 */
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* 为把手添加细微阴影 */
}

/* 开关轨道 (开启状态) */
.settings .setting input:checked + label:before {
  /* 使用主题色作为开启状态背景 */
  background: #667eea;
  transition: all 150ms cubic-bezier(0, 0, 0, 0.1);
}

/* 开关把手 (开启状态) */
.settings .setting input:checked + label:after {
  right: 14px;
  background: #ffffff; /* 开启状态使用白色把手 */
}

/* 焦点状态 (用于可访问性) */
.settings .setting input:focus + label:before {
   /* 调整焦点环颜色 */
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5); /* 使用主题色的半透明版本 */
}

.btn.generate {
  user-select: none;
  position: relative;
  width: 100%;
  height: 50px;
  margin: 10px 0;
  margin-top: 20px; /* 添加了更多顶部外边距 */
  border-radius: 8px;
  color: #fff;
  border: none;
  background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  letter-spacing: 1px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn.generate:active {
  transform: translateY(2px); /* 调整了按下状态 */
  /* 调整阴影以适应浅色背景 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}


/* 支持链接部分 (可选) */
.support {
  position: fixed;
  right: 10px;
  bottom: 10px;
  padding: 10px;
  display: flex;
}

.support a {
  margin: 0 10px; /* 减小了外边距 */
   /* 链接颜色 - 使用主题色 */
  color: #667eea;
  font-size: 1.5rem; /* 稍小一点 */
  transition: all 400ms ease;
  text-decoration: none; /* 移除下划线 */
}

.support a:hover {
   /* 悬停时加深链接颜色 */
  color: #5a6fde;
}
