@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #fffefa;
  --text: #1b2430;
  --muted: #70766f;
  --border: rgba(27, 36, 48, 0.12);
  --border-strong: rgba(27, 36, 48, 0.2);
  --accent: #e96949;
  --accent-dark: #c94e31;
  --accent-soft: #f9e4dc;
  --green: #8aa789;
  --shadow: 0 24px 70px rgba(38, 45, 41, 0.1), 0 2px 8px rgba(38, 45, 41, 0.04);
  --font-sans: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121714;
  --surface: rgba(29, 36, 32, 0.88);
  --surface-solid: #1d2420;
  --text: #f3f0e8;
  --muted: #a3aaa3;
  --border: rgba(242, 239, 231, 0.11);
  --border-strong: rgba(242, 239, 231, 0.19);
  --accent: #f27c5c;
  --accent-dark: #ff987d;
  --accent-soft: rgba(233, 105, 73, 0.14);
  --green: #8eb28f;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 9%, rgba(233, 105, 73, 0.075), transparent 29rem),
    radial-gradient(circle at 88% 88%, rgba(138, 167, 137, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 220ms ease, color 220ms ease;
}

button, input { font: inherit; }
button { color: inherit; }

button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 18rem;
  height: 18rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  opacity: 0.55;
  pointer-events: none;
}

.ambient::after {
  position: absolute;
  inset: 2.5rem;
  border: 1px solid var(--border);
  border-radius: inherit;
  content: "";
}

.ambient-one { top: -11rem; right: -7rem; }
.ambient-two { bottom: -12rem; left: -8rem; }

.app-shell {
  width: min(100% - 2rem, 760px);
  margin: 0 auto;
  padding: 2rem 0 3.25rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(3.5rem, 8vw, 6rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border: 1.5px solid var(--text);
  border-radius: 50%;
}

.brand-mark span {
  display: block;
  width: 0.55rem;
  height: 0.3rem;
  border-bottom: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  transform: translateY(-1px) rotate(-45deg);
}

.theme-toggle {
  position: relative;
  width: 3.6rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(32, 38, 35, 0.06);
}

.theme-toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--text);
  content: "";
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="dark"] .theme-toggle::after { transform: translateX(1.58rem); }

.theme-icon {
  position: absolute;
  top: 50%;
  z-index: 1;
  font-size: 0.72rem;
  line-height: 1;
  transform: translateY(-50%);
}

.theme-icon.sun { left: 0.55rem; color: var(--bg); }
.theme-icon.moon { right: 0.55rem; color: var(--text); font-size: 0.9rem; }
:root[data-theme="dark"] .theme-icon.sun { color: var(--text); }
:root[data-theme="dark"] .theme-icon.moon { color: var(--bg); }

.intro { margin-bottom: 2.25rem; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1rem;
  color: var(--accent-dark);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.eyebrow span { width: 1.5rem; height: 1px; background: var(--accent); }

h1 {
  max-width: 650px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(3.25rem, 10vw, 6rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.84;
}

h1 em { color: var(--accent); font-weight: 400; }

.intro-copy {
  max-width: 420px;
  margin: 1.6rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.task-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.task-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  margin: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.95rem;
  background: var(--surface-solid);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.task-form:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 9%, transparent);
}

.input-mark { color: var(--accent); font-size: 1.35rem; font-weight: 400; }

.task-form input {
  min-width: 0;
  padding: 0.75rem 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.task-form input::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }

.add-button {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.add-button:hover { transform: translateY(-1px); }
.add-button:active { transform: translateY(0); }

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem 1rem;
  border-top: 1px solid var(--border);
}

.filters { display: flex; gap: 0.25rem; }

.filter {
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.filter:hover { color: var(--text); }
.filter.is-active { background: var(--accent-soft); color: var(--accent-dark); }

.task-count { margin: 0; color: var(--muted); font-size: 0.76rem; }

.task-list { margin: 0; padding: 0; list-style: none; }

.task-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 4rem;
  padding: 0.65rem 1.35rem;
  border-top: 1px solid var(--border);
  animation: task-in 220ms ease both;
}

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

.task-check {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0.72rem;
  cursor: pointer;
}

.task-check:hover { border-color: var(--accent); }
.task-item.is-completed .task-check { border-color: var(--green); background: var(--green); color: #fff; }

.task-content { min-width: 0; }

.task-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.35;
  transition: color 180ms ease;
}

.task-meta { display: block; margin-top: 0.22rem; color: var(--muted); font-size: 0.67rem; }

.task-item.is-completed .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--accent); }

.task-actions { display: flex; gap: 0.2rem; opacity: 0; transition: opacity 150ms ease; }
.task-item:hover .task-actions,
.task-item:focus-within .task-actions { opacity: 1; }

.icon-button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.icon-button:hover { background: var(--accent-soft); color: var(--accent-dark); }

.edit-input {
  width: 100%;
  padding: 0.46rem 0.58rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  outline: none;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 0.9rem;
}

.empty-state { padding: 3.1rem 1.5rem 3.4rem; border-top: 1px solid var(--border); text-align: center; }
.empty-state[hidden] { display: none; }

.empty-illustration {
  position: relative;
  width: 5.5rem;
  height: 4.2rem;
  margin: 0 auto 1.1rem;
}

.empty-check {
  position: absolute;
  top: 0.2rem;
  left: 50%;
  display: grid;
  width: 3.3rem;
  height: 3.3rem;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  transform: translateX(-50%) rotate(-7deg);
}

.empty-line { position: absolute; top: 1.8rem; width: 1.25rem; height: 1px; background: var(--border-strong); }
.line-one { left: 0; transform: rotate(10deg); }
.line-two { right: 0; transform: rotate(-10deg); }

.empty-state h2 { margin: 0; font-family: var(--font-serif); font-size: 1.55rem; font-weight: 400; }
.empty-state p { margin: 0.45rem auto 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.4rem;
  gap: 1rem;
  padding: 0.75rem 1.35rem;
  border-top: 1px solid var(--border);
}

.task-footer p { display: flex; align-items: center; gap: 0.45rem; margin: 0; color: var(--muted); font-size: 0.68rem; }
.status-dot { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 17%, transparent); }

.clear-button { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 0.7rem; cursor: pointer; }
.clear-button:hover { color: var(--accent-dark); }

.privacy-note { margin: 1rem 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; text-align: center; }

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 10;
  max-width: min(22rem, calc(100vw - 2.5rem));
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.7rem;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.6rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 560px) {
  .app-shell { width: min(100% - 1.25rem, 760px); padding-top: 1.2rem; }
  .app-header { margin-bottom: 3.5rem; }
  .intro { padding: 0 0.25rem; }
  .intro-copy { font-size: 0.9rem; }
  .task-form { grid-template-columns: auto minmax(0, 1fr); }
  .add-button { grid-column: 1 / -1; justify-content: center; width: 100%; }
  .list-toolbar, .task-footer { padding-right: 1rem; padding-left: 1rem; }
  .task-item { padding-right: 0.85rem; padding-left: 1rem; }
  .task-actions { opacity: 1; }
  .task-footer p { max-width: 12rem; }
}

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