:root {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaf0;
  --text-dim: #9aa1b0;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --danger: #f43f5e;
  --success: #34d399;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.7);
  --panel-hover: rgba(255, 255, 255, 0.95);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1c2030;
  --text-dim: #6b7280;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --danger: #e11d48;
  --success: #059669;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* 背景装饰 */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 14s ease-in-out infinite;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: var(--accent);
  top: -120px;
  right: -80px;
}

.orb-2 {
  width: 340px;
  height: 340px;
  background: #8b5cf6;
  bottom: -120px;
  left: -100px;
  animation-delay: -5s;
}

.orb-3 {
  width: 260px;
  height: 260px;
  background: #06b6d4;
  top: 40%;
  left: 55%;
  opacity: 0.25;
  animation-delay: -9s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.05); }
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(15, 17, 21, 0.7);
}

[data-theme="light"] .topbar {
  background: rgba(245, 246, 250, 0.75);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
}

.brand-mark {
  font-size: 22px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}

.icon-btn:hover {
  background: var(--panel-hover);
  transform: translateY(-1px);
}

.theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: inline; }

/* 主容器 */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 24px;
}

/* Hero 区 */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.hero-datetime {
  color: var(--text-dim);
  font-size: 15px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sep { opacity: 0.5; }

.hero-weather {
  min-width: 200px;
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.weather-temp {
  font-size: 30px;
  font-weight: 700;
}

.weather-desc {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

.weather-icon {
  font-size: 36px;
}

.weather-loading {
  color: var(--text-dim);
  font-size: 14px;
}

/* 网格布局 */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-tools,
.panel-stats {
  grid-column: span 1;
}

.panel-todo {
  grid-column: span 1;
}

.panel-notes {
  grid-column: span 2;
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .panel-tools,
  .panel-todo,
  .panel-notes,
  .panel-stats {
    grid-column: span 1;
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 16px;
  font-weight: 600;
}

/* 小按钮 */
.mini-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-hover);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.mini-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.mini-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mini-btn.primary:hover {
  filter: brightness(1.1);
}

/* 快捷工具 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}

.tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--bg-soft);
  text-decoration: none;
  color: var(--text);
  position: relative;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}

.tool-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.tool-icon {
  font-size: 30px;
  line-height: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-icon img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.tool-name {
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-item:hover .tool-del {
  opacity: 1;
}

/* 待办 */
.todo-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.todo-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.todo-form input:focus {
  border-color: var(--accent);
}

.todo-progress {
  font-size: 13px;
  color: var(--text-dim);
}

.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: opacity 0.2s;
}

.todo-item.done {
  opacity: 0.55;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
}

.todo-check {
  appearance: none;
  width: 19px;
  height: 19px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.todo-check:checked {
  background: var(--success);
  border-color: var(--success);
}

.todo-check:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.todo-text {
  flex: 1;
  font-size: 14px;
  word-break: break-all;
}

.todo-del {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.todo-item:hover .todo-del {
  opacity: 1;
}

.todo-del:hover {
  color: var(--danger);
}

/* 便签 */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.note-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  position: relative;
  transition: transform 0.15s, border-color 0.2s;
}

.note-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.note-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  padding-right: 20px;
  word-break: break-all;
}

.note-content {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-date {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
  margin-top: 8px;
}

.note-del {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.note-card:hover .note-del {
  opacity: 1;
}

.note-del:hover {
  color: var(--danger);
}

/* 统计 */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  text-align: center;
  padding: 16px 8px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

@media (max-width: 560px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 空状态 */
.empty-tip {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

/* 弹窗 */
.modal {
  border: none;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  box-shadow: var(--shadow);
  width: min(420px, 92vw);
  padding: 0;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.modal-body input,
.modal-body textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s;
}

.modal-body input:focus,
.modal-body textarea:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* 页脚 */
.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 24px;
}

/* 工具类 */
.hidden {
  display: none !important;
}

/* 动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  animation: fadeInUp 0.5s ease both;
}

.panel:nth-child(2) { animation-delay: 0.06s; }
.panel:nth-child(3) { animation-delay: 0.12s; }
.panel:nth-child(4) { animation-delay: 0.18s; }
