:root {
  --bg: #0f1220;
  --card: #151a2d;
  --muted: #8b92a6;
  --text: #e8ecf3;
  --primary: #5b8cff;
  --primary-press: #3e6ef0;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% 10%, #131733 0%, var(--bg) 60%), linear-gradient(160deg, #0e1122, #0b0e1a);
}

.container {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: calc(24px + env(safe-area-inset-top)) clamp(16px, 4vw, 48px) calc(24px + env(safe-area-inset-bottom)) clamp(16px, 4vw, 48px);
}

.app-title {
  margin: 0 0 16px 0;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: 1px;
  text-align: center;
}

.setup-card, .timer-card {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  align-self: center; /* 使主体内容在可用高度内垂直居中 */
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 22px;
  padding: clamp(18px, 4vw, 32px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: saturate(180%) blur(18px);
}

.hidden { display: none; }

.setup-form { display: grid; gap: 16px; }

.form-row { display: grid; gap: 8px; }
.form-row label { color: var(--muted); font-size: 14px; }
.form-row input[type="text"],
.form-row input[type="datetime-local"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
}
.form-row input::placeholder { color: #9aa3b2; }
.form-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91,140,255,0.15); }

.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.error { color: var(--danger); min-height: 1.2em; }

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform .06s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.2); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-press); border-color: var(--primary-press); }

.timer-title { margin: 0 0 clamp(24px, 6vw, 40px); font-size: clamp(22px, 4.8vw, 30px); color: var(--muted); text-align: center; }
.timer-title span { color: var(--text); font-weight: 600; }

/* 显示标题更鲜艳靓丽的效果 */
#displayTitle {
  background: linear-gradient(90deg, #ff7a7a, #ffd056, #7fff8a, #6ac8ff, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.2;
  background-size: 200% 200%;
  animation: gradientShift 8s linear infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  #displayTitle { animation: none; }
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 3.6vw, 24px);
  justify-items: center; /* 使每个时间块内容居中 */
}

.time-box {
  text-align: center;
  padding: clamp(16px, 3.8vw, 24px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
}
.time-number {
  font-size: clamp(40px, 10vw, 84px);
  font-weight: 700;
  line-height: 1.1;
}
.time-label { color: var(--muted); margin-top: 8px; font-size: clamp(12px, 2.6vw, 16px); }

.timer-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

.footer {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px 0 0;
}

@media (max-width: 640px) {
  /* 手机：第一行仅“天”，第二行为“时/分/秒” */
  .timer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "days days days"
      "hours minutes seconds";
    gap: clamp(14px, 4vw, 24px);
  }
  .timer-grid .time-box:nth-child(1) { grid-area: days; }
  .timer-grid .time-box:nth-child(2) { grid-area: hours; }
  .timer-grid .time-box:nth-child(3) { grid-area: minutes; }
  .timer-grid .time-box:nth-child(4) { grid-area: seconds; }

  .time-box { padding: clamp(18px, 5vw, 26px); border-radius: 22px; }
  .time-number { font-size: clamp(44px, 14vw, 72px); }
  .timer-card { padding: clamp(18px, 6vw, 30px); }
  .btn { padding: 14px 18px; border-radius: 18px; font-size: 16px; }
}


