:root {
  --bg: #eef2ef;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --text: #171717;
  --text-muted: #6b7280;
  --border: rgba(23, 23, 23, 0.09);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-blur: blur(16px) saturate(170%);
  --brand: #0ab861;
  --brand-soft: #e5fff2;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 36, 26, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 36, 26, 0.08);
  --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
}

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

/* 去掉手机端点击时出现的蓝色方框 */
* {
  -webkit-tap-highlight-color: transparent;
}

button, a, input, select, textarea {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(10, 184, 97, 0.45);
  outline-offset: 2px;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* 背景：三层柔和光晕 + 底色，比纯灰更有呼吸感 */
  background-image:
    radial-gradient(1100px 620px at 8% -12%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(900px 520px at 96% 2%, rgba(56, 132, 255, 0.10), transparent 58%),
    radial-gradient(800px 620px at 46% 108%, rgba(16, 185, 129, 0.10), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header h1 { font-size: 20px; font-weight: 600; }

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}

.back-link:hover { background: rgba(10, 184, 97, 0.10); color: var(--brand); }
.back-link:active { transform: scale(0.92); }

.status {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-ok { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

.container {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}

.intro { font-size: 18px; margin-bottom: 24px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  display: block;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
              border-color 0.2s var(--ease), background 0.2s var(--ease);
  animation: card-in 0.45s var(--ease) both;
}

/* 卡片依次淡入，避免一起蹦出来 */
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.18s; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card:hover {
  border-color: rgba(10, 184, 97, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(16, 36, 26, 0.12);
  background: rgba(255, 255, 255, 0.85);
}

.card:active { transform: translateY(-1px) scale(0.985); }

.card svg {
  width: 36px;
  height: 36px;
  color: var(--brand);
  margin-bottom: 16px;
}

.card h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--text-muted); }

.tag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}

.site-footer {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* ===== 手机端适配 ===== */
@media (max-width: 640px) {
  .site-header { padding: 14px 16px; }
  .site-header h1 { font-size: 17px; }
  .container { padding: 24px 16px; }
  .intro { font-size: 16px; }
  .card { padding: 22px 18px; }
  /* 手机端关掉 hover 抬升，避免点完还悬在半空 */
  .card:hover { transform: none; box-shadow: var(--shadow-sm); }
}

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 360px;
  max-width: 100%;
  padding: 32px 28px 28px;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(16, 36, 26, 0.12);
  animation: card-in 0.45s var(--ease) both;
}

.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.login-card .login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.login-field label { font-size: 13px; color: var(--text-muted); }

.login-field input {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.login-field input:focus {
  border-color: rgba(10, 184, 97, 0.5);
  box-shadow: 0 0 0 3px rgba(10, 184, 97, 0.12);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 12px;
  padding: 12px 0;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.login-btn:hover { background: #09a656; box-shadow: 0 8px 20px rgba(10, 184, 97, 0.3); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; cursor: default; box-shadow: none; }

.login-error {
  font-size: 13px;
  color: #c23a3a;
  background: rgba(224, 82, 82, 0.10);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  animation: fade-in 0.24s var(--ease);
}

@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ===== 登录后的问候语：中央显示 → 缩到左上角 ===== */
.greeting {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 8% -12%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(900px 520px at 96% 2%, rgba(56, 132, 255, 0.10), transparent 58%),
    radial-gradient(800px 620px at 46% 108%, rgba(16, 185, 129, 0.10), transparent 62%);
  transition: opacity 0.35s var(--ease);
}

.greeting-text {
  /* 刚出现时字号更大，像从水下浮上来 */
  font-size: clamp(44px, 7.5vw, 76px);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  transform-origin: center;
  opacity: 0;
  transform: translateY(30px) scale(0.94);
  filter: blur(12px);
  transition:
    opacity 0.8s var(--ease),
    transform 1.05s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.9s var(--ease);
}

.greeting.emerge .greeting-text {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* 停一会儿后缓缓缩向左上角，落点正好在标题栏 */
.greeting.settle .greeting-text {
  opacity: 0;
  transform: translate(-38vw, -42vh) scale(0.28);
  filter: blur(5px);
  transition:
    transform 1.15s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.75s var(--ease) 0.35s,
    filter 1s var(--ease);
}

.greeting.done { opacity: 0; pointer-events: none; }

/* display:flex 会盖掉 hidden 属性的隐藏效果，这里补回来，否则动画结束后整页点不动 */
.greeting[hidden] { display: none; }

.site-header, .container, .site-footer { transition: opacity 0.4s var(--ease); }

/* 左上角的常驻问候 */
.hello-name { font-size: 13px; color: var(--text-muted); font-weight: 400; margin-left: 10px; }

/* ===== 左下角设置按钮 ===== */
.settings-fab {
  position: fixed;
  left: 28px;
  bottom: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 25;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.settings-fab:hover { color: var(--brand); transform: translateY(-2px) rotate(12deg); }
.settings-fab:active { transform: scale(0.94); }
.settings-fab svg { width: 22px; height: 22px; }

/* ===== 设置弹窗 ===== */
.hub-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 32, 28, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlay-in 0.22s var(--ease);
}
.hub-overlay[hidden] { display: none; }

.hub-modal {
  width: 380px;
  max-width: 100%;
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 60px rgba(16, 36, 26, 0.22);
  animation: modal-in 0.26s var(--ease);
}

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }

.hub-modal h2 { font-size: 17px; font-weight: 600; margin-bottom: 18px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row .setting-label { font-size: 14px; }
.setting-row .setting-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 开关滑块 */
.toggle { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.12);
  transition: background 0.2s var(--ease);
  display: block;
}
.toggle-track::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s var(--ease);
}
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

.pwd-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.pwd-form input {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}
.pwd-form input:focus { border-color: rgba(10, 184, 97, 0.5); }

.pwd-tip { font-size: 12px; min-height: 16px; margin-top: 2px; }
.pwd-tip.ok { color: #0a8f4c; }
.pwd-tip.err { color: #c23a3a; }

.hub-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.hub-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.hub-btn:hover { background: rgba(255, 255, 255, 1); }
.hub-btn:active { transform: scale(0.97); }
.hub-btn.primary { background: var(--brand); border-color: transparent; color: #fff; font-weight: 500; }
.hub-btn.primary:hover { background: #09a656; }
.hub-btn.ghost { background: transparent; color: var(--text-muted); }

/* ===== 黑夜模式 ===== */
html.dark {
  --bg: #0e1411;
  --surface: rgba(26, 34, 30, 0.72);
  --surface-solid: #1a211d;
  --text: #e7efea;
  --text-muted: #94a39b;
  --border: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.12);
  --brand-soft: rgba(10, 184, 97, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
}

html.dark body {
  background-image:
    radial-gradient(1100px 620px at 8% -12%, rgba(16, 185, 129, 0.20), transparent 62%),
    radial-gradient(900px 520px at 96% 2%, rgba(56, 132, 255, 0.12), transparent 58%),
    radial-gradient(800px 620px at 46% 108%, rgba(16, 185, 129, 0.12), transparent 62%);
}

html.dark .site-header { background: rgba(18, 24, 21, 0.72); }
html.dark .site-footer { background: rgba(18, 24, 21, 0.5); }
html.dark .status { background: rgba(255, 255, 255, 0.08); }
html.dark .status-ok { background: var(--brand-soft); }
html.dark .card:hover { background: rgba(38, 48, 43, 0.92); }
html.dark .settings-fab { background: rgba(30, 39, 34, 0.8); }
html.dark .hub-modal { background: rgba(26, 34, 30, 0.92); border-color: rgba(255, 255, 255, 0.12); }
html.dark .login-field input,
html.dark .pwd-form input { background: rgba(255, 255, 255, 0.07); color: var(--text); }
html.dark .hub-btn { background: rgba(255, 255, 255, 0.08); }
html.dark .hub-btn.primary { background: var(--brand); }
html.dark .hub-btn.danger { background: rgba(224, 82, 82, 0.16); color: #ff9a9a; }

/* 退出登录 */
.logout-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
}
.hub-btn.danger {
  background: rgba(224, 82, 82, 0.08);
  border-color: transparent;
  color: #c23a3a;
}
.hub-btn.danger:hover { background: rgba(224, 82, 82, 0.16); }
html.dark .greeting { background-color: var(--bg); }

@media (max-width: 640px) {
  .settings-fab { left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 44px; height: 44px; }
  .hub-overlay { align-items: flex-end; padding: 0; }
  .hub-modal {
    width: 100%;
    border-radius: 22px 22px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    animation: hub-sheet-in 0.3s var(--ease);
  }
  @keyframes hub-sheet-in { from { transform: translateY(100%); opacity: 0.6; } to { transform: none; opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== 全局交互统一：更顺滑的按压、涟漪与切换 ===== */
html { scroll-behavior: smooth; }

/* 按压缩放：用 :where 保持零权重，不覆盖各页面已有的精细动效 */
:where(button:not(:disabled)):active { transform: scale(0.97); }

body { transition: opacity 0.16s ease; }
body.page-leave { opacity: 0; pointer-events: none; }

/* 点击涟漪 */
.ui-ink-host { position: relative; overflow: hidden; }
.ui-ink {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: currentColor;
  opacity: 0.22;
  transform: scale(0);
  animation: ui-ink 0.55s ease-out forwards;
}
@keyframes ui-ink {
  to { transform: scale(2.4); opacity: 0; }
}

/* 列表错峰出现：让一批条目依次浮入，而不是同时闪现 */
.todo-list > .todo-item:nth-child(2),
.ddl-list > .ddl-item:nth-child(2),
.drive-list > .drive-item:nth-child(2) { animation-delay: 0.04s; }
.todo-list > .todo-item:nth-child(3),
.ddl-list > .ddl-item:nth-child(3),
.drive-list > .drive-item:nth-child(3) { animation-delay: 0.08s; }
.todo-list > .todo-item:nth-child(4),
.ddl-list > .ddl-item:nth-child(4),
.drive-list > .drive-item:nth-child(4) { animation-delay: 0.12s; }
.todo-list > .todo-item:nth-child(5),
.ddl-list > .ddl-item:nth-child(5),
.drive-list > .drive-item:nth-child(5) { animation-delay: 0.16s; }
.todo-list > .todo-item:nth-child(6),
.ddl-list > .ddl-item:nth-child(6),
.drive-list > .drive-item:nth-child(6) { animation-delay: 0.20s; }
.todo-list > .todo-item:nth-child(n+7),
.ddl-list > .ddl-item:nth-child(n+7),
.drive-list > .drive-item:nth-child(n+7) { animation-delay: 0.24s; }

/* 弹窗关闭动画（设置弹窗 / DDL 弹窗） */
.hub-overlay.closing,
.ddl-overlay.closing {
  animation: ui-overlay-out 0.18s ease forwards;
  pointer-events: none;
}
.hub-overlay.closing .hub-modal,
.ddl-overlay.closing .ddl-modal {
  animation: ui-modal-out 0.18s ease forwards;
}
@keyframes ui-overlay-out {
  to { opacity: 0; }
}
@keyframes ui-modal-out {
  to { opacity: 0; transform: translateY(8px) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
