/* ===== app.css — 各功能模块样式 ===== */

/* ---- 分段控制器 (segmented control) ---- */
.seg {
  display: flex;
  background: var(--card-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}
.seg-item {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.seg-item.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pane { display: none; }
.pane.is-active { display: block; animation: fade-in 0.25s ease; }

/* ---- 倒计时圆环 ---- */
.dial {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 8px auto 28px;
}
.dial-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.dial-track {
  fill: none;
  stroke: var(--card-2);
  stroke-width: 14;
}
.dial-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 691.15; /* 2πr, r=110 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s linear, stroke 0.3s;
}
.dial.is-done .dial-progress { stroke: var(--danger); }
.dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dial-time {
  font-family: var(--font-num);
  font-size: 56px;
  font-weight: 300;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.dial-label { font-size: 14px; color: var(--text-3); }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.dial.is-done { animation: pulse 0.8s ease infinite; }

/* ---- 预设时长 chips ---- */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
}
.chip {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.08s;
}
.chip:active { transform: scale(0.94); }
.chip.is-active { background: var(--accent-weak); color: var(--accent); }

/* ---- 自定义时间 ---- */
.custom-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--text-3);
  font-size: 14px;
}
.custom-time label { display: inline-flex; align-items: center; gap: 6px; }
.custom-time input {
  width: 64px;
  height: 40px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  border: none;
  color: var(--text);
  font-weight: 600;
}
.custom-time .colon { font-weight: 700; color: var(--text); }

/* ---- 控制按钮组 ---- */
.controls {
  display: flex;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}

/* ---- 秒表 ---- */
.sw-display {
  font-family: var(--font-num);
  font-size: 68px;
  font-weight: 200;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin: 40px 0 36px;
  letter-spacing: 1px;
}
.sw-ms { font-size: 34px; color: var(--text-3); }
.laps {
  margin-top: 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-1);
}
.laps li {
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  font-variant-numeric: tabular-nums;
  border-bottom: 0.5px solid var(--separator);
}
.laps li:last-child { border-bottom: none; }
.laps .lap-idx { color: var(--text-3); }
.laps .lap-time { font-weight: 600; }

/* ---- 闹钟列表 ---- */
.alarm-list { display: flex; flex-direction: column; gap: 12px; }
.alarm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  animation: fade-in 0.25s ease;
}
.alarm-info { display: flex; flex-direction: column; gap: 2px; }
.alarm-item .a-time {
  font-family: var(--font-num);
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.alarm-item.off .a-time { color: var(--text-3); }
.alarm-item .a-label { font-size: 14px; color: var(--text-3); }
.alarm-actions { display: flex; align-items: center; gap: 14px; }
.a-del {
  font-size: 20px;
  color: var(--text-3);
  width: 32px; height: 32px;
  display: grid; place-items: center;
}

/* iOS 开关 */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--separator);
  border-radius: 999px;
  transition: background 0.25s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 27px; height: 27px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 空状态 */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 80px 20px;
}
.empty-icon { font-size: 56px; margin-bottom: 14px; opacity: 0.5; }
.empty p { font-size: 15px; }

/* FAB */
.fab {
  position: fixed;
  right: max(20px, calc(50% - 280px + 20px));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  display: grid; place-items: center;
  box-shadow: var(--shadow-fab);
  z-index: 15;
  transition: transform 0.1s;
}
.fab:active { transform: scale(0.9); }

/* 闹钟时间输入 */
.alarm-time-input {
  width: 100%;
  height: 60px;
  text-align: center;
  font-size: 32px;
  font-weight: 300;
  border: none;
  background: var(--card-2);
  border-radius: var(--radius-md);
  color: var(--text);
  margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-size: 13px; color: var(--text-3); padding-left: 4px; }
.field input {
  height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  border: none;
  color: var(--text);
}

/* ---- 天气 ---- */
.weather-card {
  background: linear-gradient(160deg, #4a90e2, #6cb2eb);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.weather-loading { font-size: 15px; opacity: 0.9; }
.weather-main { width: 100%; }
.weather-city { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.weather-icon { font-size: 64px; line-height: 1; margin: 4px 0; }
.weather-temp {
  font-family: var(--font-num);
  font-size: 72px;
  font-weight: 200;
  line-height: 1;
}
.weather-desc { font-size: 17px; margin-top: 6px; }
.weather-range { font-size: 14px; opacity: 0.85; margin-top: 10px; }

.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.wg-item {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-1);
}
.wg-label { font-size: 13px; color: var(--text-3); }
.wg-val { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

.weather-refresh { width: 100%; height: 46px; }

/* ===== 首页：功能集合（圆角方块网格） ===== */
.home-hero { padding: 12px 6px 22px; }
.home-greet { font-size: 26px; font-weight: 700; }
.home-sub { font-size: 15px; color: var(--text-3); margin-top: 6px; }

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.feature-card {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s;
}
.feature-card:active { transform: scale(0.95); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.fc-ring {
  width: 58px; height: 58px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 30px;
  color: #fff;
  flex: none;
  margin-bottom: 2px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.fc-1 { background: linear-gradient(145deg, #ff9a3c, #ff6a3c); }
.fc-2 { background: linear-gradient(145deg, #5ac8fa, #007aff); }
.fc-3 { background: linear-gradient(145deg, #a5d8ff, #4a90e2); }

.fc-title { font-size: 17px; font-weight: 600; }
.fc-desc { font-size: 12px; color: var(--text-3); line-height: 1.3; }
.fc-preview {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.fc-chev { display: none; }

/* 占位卡（更多功能即将上线） */
.is-placeholder {
  background: transparent;
  border: 2px dashed var(--separator);
  box-shadow: none;
}
.is-placeholder .fc-ring {
  background: var(--card-2);
  color: var(--text-3);
  box-shadow: none;
}
.is-placeholder .fc-title { color: var(--text-3); }
.is-placeholder .fc-desc { color: var(--text-3); }
.is-placeholder .fc-preview { color: var(--text-3); }

.home-foot {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin-top: 26px;
}

/* ===== 气象预警 ===== */
.alerts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  animation: fade-in 0.3s ease;
}
.alert .a-emoji { font-size: 20px; line-height: 1.2; flex: none; }
.alert .a-text { flex: 1; }
.alert-strong { background: linear-gradient(145deg, #ff5e62, #ff2d55); }
.alert-wind   { background: linear-gradient(145deg, #4facfe, #007aff); }
.alert-cold   { background: linear-gradient(145deg, #5fb3ff, #2f80ed); }
.alert-hot    { background: linear-gradient(145deg, #ff9a3c, #ff6a3c); }
.alert-fog    { background: linear-gradient(145deg, #9aa7b5, #6b7785); }

/* ===== 穿衣建议 ===== */
.advice-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px 18px;
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
  animation: fade-in 0.3s ease;
}
.advice-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.advice-text { font-size: 14px; color: var(--text-2); line-height: 1.55; }
