:root {
  --bg: #0a0e14;
  --bg-card: rgba(19, 25, 34, 0.72);
  --bg-card-2: rgba(15, 20, 28, 0.72);
  --fg: #e7ebef;
  --fg-dim: #8a93a0;
  --fg-faint: #5a626d;
  --accent: #5b9dff;
  --accent-2: #4ade80;
  --warn: #f59e0b;
  --danger: #f87171;
  --border: rgba(255, 255, 255, 0.07);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;
}

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

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ===== 极光背景:缓慢飘动的彩色光斑 ===== */
.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.22;
  will-change: transform;
}
.blob1 { width: 55vmax; height: 55vmax; background: #3b6dd8; top: -20%; left: -15%; animation: drift1 32s ease-in-out infinite; }
.blob2 { width: 45vmax; height: 45vmax; background: #7c3aed; top: 25%; right: -15%; animation: drift2 38s ease-in-out infinite; }
.blob3 { width: 40vmax; height: 40vmax; background: #0ea5e9; bottom: -15%; left: 35%; animation: drift3 45s ease-in-out infinite; }
@keyframes drift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(12vw, 8vh) scale(1.15); } }
@keyframes drift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-10vw, -6vh) scale(1.1); } }
@keyframes drift3 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vw, -10vh) scale(1.2); } }

#app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  width: 100vw;
  padding:
    calc(env(safe-area-inset-top) + 2.6vh)
    calc(env(safe-area-inset-right) + 3vw)
    calc(env(safe-area-inset-bottom) + 1.6vh)
    calc(env(safe-area-inset-left) + 3vw);
  gap: 1.6vh;
  overflow: hidden;
  background: transparent;
}

/* ===== 顶部:时钟居中放大 + 天气小条 ===== */
.top { display: flex; flex-direction: column; align-items: center; gap: 1.6vh; min-width: 0; }
.hero-clock { text-align: center; }
.clock {
  font-family: var(--mono);
  font-size: clamp(64px, 15vw, 176px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0.5vh 0;
  background: linear-gradient(100deg, #e7ebef 0%, #a5c8ff 35%, #c4b5fd 65%, #e7ebef 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textShimmer 14s linear infinite;
}
@keyframes textShimmer { to { background-position: 200% center; } }

.date { margin-top: 0.8vh; font-size: clamp(15px, 2vw, 24px); color: var(--fg-dim); font-weight: 400; text-align: center; }

.weather-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1vw;
  flex-wrap: wrap;
  font-size: clamp(13px, 1.6vw, 18px);
  color: var(--fg-dim);
  padding: 0.9vh 1.8vw;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-width: 92vw;
}
.weather-bar .weather-icon { font-size: clamp(22px, 2.6vw, 32px); line-height: 1; }
.weather-bar .weather-temp { font-size: clamp(20px, 2.4vw, 28px); color: var(--fg); font-weight: 300; font-variant-numeric: tabular-nums; }
.weather-bar .weather-cond { color: var(--fg); }
.weather-bar .weather-sub { color: var(--fg-dim); }
.weather-bar .weather-daily-inline { color: var(--fg-faint); font-size: clamp(12px, 1.4vw, 15px); }
.weather-bar .weather-loading { color: var(--fg-dim); }

/* ===== 底部:速记 + 提醒 ===== */
.bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2vw;
  min-height: 0;
}
.notes-block, .reminders-block { display: flex; flex-direction: column; min-height: 0; }

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex: 0 0 auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.form-prefix { font-size: 13px; color: var(--fg-faint); width: 18px; text-align: center; flex: 0 0 auto; }
.text-input {
  flex: 1 1 auto;
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--font); font-size: 16px; min-width: 0;
}
.text-input::placeholder { color: var(--fg-faint); }

.voice-btn {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(91, 157, 255, 0.14);
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.voice-btn:active { transform: scale(0.92); }
.voice-btn.recording {
  background: rgba(248, 113, 113, 0.25);
  color: var(--danger);
  animation: rec-pulse 1.1s ease-in-out infinite;
}
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.list {
  list-style: none;
  margin-top: 1.4vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
  flex: 1 1 auto;
  min-height: 0;
}
.list::-webkit-scrollbar { width: 4px; }
.list::-webkit-scrollbar-thumb { background: var(--fg-faint); border-radius: 2px; }

.list-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 7px;
  font-size: 15px; line-height: 1.4;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.list-item .body { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.list-item .del {
  background: none; border: none; color: var(--fg-faint);
  font-size: 18px; line-height: 1; padding: 0 2px; cursor: pointer; flex: 0 0 auto;
}
.list-item .del:hover { color: var(--danger); }
.note-list .list-item .time { color: var(--fg-faint); font-size: 12px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.reminders-block .list-item .time-tag {
  font-size: 12px; color: var(--accent);
  background: rgba(91, 157, 255, 0.12);
  padding: 2px 7px; border-radius: 6px;
  font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto;
}
.reminders-block .list-item.done .time-tag { color: var(--fg-faint); background: rgba(255,255,255,0.04); }
.reminders-block .list-item.done .body { color: var(--fg-faint); text-decoration: line-through; }
.reminders-block .list-item.due .time-tag { color: var(--warn); background: rgba(245,158,11,0.12); }

/* ===== 天气特效(雨滴/雪花) ===== */
.weather-fx {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.raindrop {
  position: absolute;
  top: -20px;
  width: 1px;
  background: linear-gradient(transparent, rgba(180, 200, 255, 0.6));
  animation: rain-fall linear infinite;
}
@keyframes rain-fall { to { transform: translateY(110vh); } }
.snowflake {
  position: absolute;
  top: -20px;
  color: rgba(255, 255, 255, 0.85);
  animation: snow-fall linear infinite;
  will-change: transform;
}
@keyframes snow-fall {
  0% { transform: translateY(0) translateX(0) rotate(0deg); }
  100% { transform: translateY(110vh) translateX(20px) rotate(360deg); }
}

/* ===== 提醒全屏遮罩 ===== */
.alarm-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: pulse 2s ease-in-out infinite;
}
.alarm-overlay.hidden { display: none; }
@keyframes pulse { 0%, 100% { background: rgba(10,14,20,0.92); } 50% { background: rgba(30,40,60,0.95); } }
.alarm-card {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 40px 48px;
  text-align: center; max-width: 80vw;
  box-shadow: 0 0 60px rgba(91,157,255,0.3);
}
.alarm-label { color: var(--accent); font-size: 14px; letter-spacing: 0.2em; margin-bottom: 14px; }
.alarm-title { font-size: 30px; font-weight: 500; margin-bottom: 8px; }
.alarm-time { color: var(--fg-dim); font-size: 15px; margin-bottom: 26px; }
.alarm-btn {
  background: var(--accent); color: #fff; border: none;
  border-radius: 12px; padding: 12px 36px; font-size: 16px; font-family: var(--font); cursor: pointer;
}
.alarm-btn:active { transform: scale(0.97); }

/* 窄屏(竖屏等)适配:上下堆叠 */
@media (max-width: 740px) {
  #app { grid-template-rows: auto auto 1fr; }
  .bottom { grid-template-columns: 1fr; gap: 1.2vh; }
}

/* 尊重系统的「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  .blob, .clock, .alarm-overlay, .voice-btn.recording, .raindrop, .snowflake { animation: none !important; }
}
