:root {
  --bg: #f8fafc;         /* 明亮背景 */
  --bg-card: #ffffff;
  --fg: #0f172a;
  --fg-muted: #64748b;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --border: #e2e8f0;
  --radius: 14px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app-header h1 {
  font-size: 1.6rem;
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: linear-gradient(90deg, #4f46e5, #9333ea);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* 版本徽标：必须还原为普通小字（否则继承渐变透明看不清） */
.app-version {
  font-size: .7rem;
  font-weight: 400;
  color: #6b7280;
  background: none;
  -webkit-background-clip: initial; background-clip: initial;
  -webkit-text-fill-color: #6b7280;
  white-space: nowrap;
  user-select: none;
  vertical-align: middle;
}

.subtitle { color: var(--fg-muted); font-size: .85rem; margin-top: 6px; }

/* ---- 表单 ---- */
.todo-form {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.todo-form-row { display: flex; gap: 8px; }

.todo-input {
  flex: 1;
  min-width: 0;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
}
.todo-input:focus { border-color: var(--accent); }

.btn-add {
  flex: none;
  width: 46px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.btn-add:active { transform: scale(.96); }

.todo-date {
  margin-top: 8px;
  width: 100%;
  min-width: 0;      /* 允许收缩到固有宽度以下 */
  max-width: 100%;   /* 硬性限制，防止 iOS 固有宽度溢出 */
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg-muted);
  padding: 8px 14px;
  font-size: .9rem;
  color-scheme: light;
}

/* ---- 列表 ---- */
.todo-list {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.todo-check {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  color: #fff;
  font-size: .9rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.todo-item.done .todo-check { background: var(--accent); }

.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.todo-text { word-break: break-word; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--fg-muted); }

.todo-date-label { font-size: .75rem; color: var(--fg-muted); }

.todo-del {
  flex: none;
  border: none;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  opacity: .6;
  padding: 4px;
}
.todo-del:hover { opacity: 1; }

.empty-tip { text-align: center; color: var(--fg-muted); margin-top: 32px; }
.hidden { display: none !important; }

.app-footer { margin-top: 24px; text-align: center; color: var(--fg-muted); font-size: .8rem; }
