:root {
  color-scheme: light;
  --page: #faf9f6;
  --surface: rgba(255, 255, 255, 0.88);
  --text: #20262c;
  --muted: #7c838b;
  --line: rgba(38, 47, 56, 0.09);
  --shadow: 0 12px 34px rgba(45, 55, 65, 0.08), 0 2px 8px rgba(45, 55, 65, 0.04);
  --rest: #35a45e;
  --rest-soft: #eef8f0;
  --study: #3486e8;
  --study-soft: #edf5ff;
  --danger: #ff5d57;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 15px;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(78, 180, 111, 0.07), transparent 24rem),
    radial-gradient(circle at 90% 10%, rgba(52, 134, 232, 0.07), transparent 28rem),
    var(--page);
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  max-width: 1240px;
  height: calc(76px + env(safe-area-inset-top));
  margin: 0 auto;
  padding: env(safe-area-inset-top) 26px 0;
  background: rgba(250, 249, 246, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.app-header h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(21px, 3vw, 27px);
  font-weight: 750;
  letter-spacing: -0.03em;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.icon-button:hover { background: rgba(120, 130, 140, 0.09); }
.icon-button:active { transform: scale(0.94); }
.icon-button svg { width: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }

.app-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  width: min(1180px, calc(100% - 48px));
  margin: 24px auto max(42px, env(safe-area-inset-bottom));
}

.task-board {
  --accent: var(--rest);
  --accent-soft: var(--rest-soft);
  display: flex;
  min-height: 620px;
  padding: 24px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.study-board { --accent: var(--study); --accent-soft: var(--study-soft); }

.board-intro {
  display: flex;
  min-height: 142px;
  padding: 27px 28px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.58));
}

.board-intro h2 {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: clamp(23px, 3vw, 31px);
  letter-spacing: -0.025em;
}

.board-intro p { margin: 0; color: var(--muted); font-size: 17px; }
.intro-art { margin-left: 16px; font-size: 53px; filter: drop-shadow(0 9px 8px rgba(40, 70, 50, 0.12)); transform: rotate(3deg); }

.task-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; margin: 26px 8px; }
.task-form input {
  width: 100%;
  min-height: 58px;
  padding: 0 19px;
  color: var(--text);
  border: 1px solid var(--line);
  outline: none;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px rgba(50, 60, 70, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.task-form input::placeholder { color: #a1a6ac; }
.task-form input:focus { border-color: color-mix(in srgb, var(--accent) 55%, white); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.task-form button {
  min-width: 92px;
  min-height: 58px;
  padding: 0 22px;
  color: white;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 24%, transparent);
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}
.task-form button:hover { filter: brightness(1.05); }
.task-form button:active { transform: scale(0.97); }

.task-list { display: grid; gap: 13px; margin: 0 0 24px; padding: 0; list-style: none; }
.task-list:empty::before {
  content: "还没有任务，添加一件小事吧";
  display: grid;
  min-height: 144px;
  place-items: center;
  color: #a0a6ab;
  font-size: 15px;
  border: 1px dashed color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent-soft) 46%, transparent);
}

.task-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 42px;
  min-height: 76px;
  padding: 12px 10px 12px 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 5px 14px rgba(45, 55, 65, 0.06);
  animation: task-in 220ms ease both;
}

@keyframes task-in { from { opacity: 0; transform: translateY(6px); } }

.complete-button, .delete-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.complete-button {
  width: 27px;
  height: 27px;
  color: transparent;
  border: 2px solid color-mix(in srgb, var(--accent) 76%, white);
  border-radius: 50%;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.complete-button svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.complete-button:hover { transform: scale(1.08); }
.task-text { padding: 0 10px; overflow-wrap: anywhere; font-size: 17px; line-height: 1.45; transition: color 160ms ease; }
.delete-button { justify-self: end; color: var(--danger); border-radius: 12px; }
.delete-button:hover { background: rgba(255, 93, 87, 0.09); }
.delete-button svg, .clear-button svg { width: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.task-item.is-complete .complete-button { color: white; background: var(--accent); border-color: var(--accent); }
.task-item.is-complete .task-text { color: #9ba0a5; text-decoration: line-through; text-decoration-thickness: 1.5px; }

.clear-button {
  display: flex;
  width: 100%;
  min-height: 60px;
  margin-top: auto;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--accent);
  font-weight: 650;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}
.clear-button:hover { filter: saturate(1.25); }
.clear-button:active { transform: scale(0.985); }
.clear-button:disabled { opacity: 0.45; cursor: default; }

.toast {
  position: fixed;
  z-index: 30;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  padding: 11px 18px;
  color: white;
  border-radius: 999px;
  background: rgba(32, 38, 44, 0.88);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.dark {
  color-scheme: dark;
  --page: #171a1d;
  --surface: rgba(34, 38, 42, 0.91);
  --text: #f1f3f4;
  --muted: #a5abb2;
  --line: rgba(255, 255, 255, 0.08);
  --rest-soft: #21392a;
  --study-soft: #1e3149;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}
body.dark .app-header { background: rgba(23, 26, 29, 0.82); }
body.dark .task-form input, body.dark .task-item { background: rgba(27, 30, 34, 0.9); }
body.dark .board-intro { background: linear-gradient(135deg, var(--accent-soft), rgba(40, 44, 48, 0.6)); }

@media (max-width: 760px) {
  .app-header { height: calc(66px + env(safe-area-inset-top)); padding-inline: 14px; }
  .app-shell { grid-template-columns: 1fr; gap: 18px; width: calc(100% - 24px); margin-top: 12px; }
  .task-board { min-height: 520px; padding: 15px; border-radius: 24px; }
  .board-intro { min-height: 124px; padding: 22px 20px; }
  .board-intro h2 { margin-bottom: 10px; }
  .board-intro p { font-size: 15px; }
  .intro-art { font-size: 42px; }
  .task-form { margin: 18px 2px; }
  .task-form input, .task-form button { min-height: 54px; }
  .task-form button { min-width: 76px; padding-inline: 16px; }
  .task-item { min-height: 70px; }
  .task-text { font-size: 16px; }
  .clear-button { min-height: 56px; }
}

@media (max-width: 374px) {
  .task-form { grid-template-columns: 1fr; }
  .task-form button { width: 100%; }
  .intro-art { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
