/* ==========================================================================
   To-Do List — animated UI
   Effects used (inspired by common web-animation showcases):
   ambient background motion, morphing blobs, animated gradients,
   glassmorphism, self-drawing SVG line art, staggered list entrances,
   hover micro-interactions, animated strikethrough + progress bar.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  --brand-1: #7c5cff;
  --brand-2: #ff5cf0;
  --brand-3: #2ee6c5;
  --gradient: linear-gradient(115deg, var(--brand-1), var(--brand-2) 52%, var(--brand-3));

  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --ease-out: cubic-bezier(0.22, 0.68, 0.16, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  --ring: 0 0 0 3px color-mix(in srgb, var(--brand-1) 45%, transparent);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #05070f;
  --bg-1: #0b1122;
  --text: #eef2ff;
  --text-strong: #ffffff;
  --muted: #97a4c9;
  --muted-dim: #6b789e;

  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-3: rgba(255, 255, 255, 0.16);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.24);
  --input-bg: rgba(6, 10, 22, 0.55);
  --card-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.95),
    0 8px 30px -18px rgba(124, 92, 255, 0.6);
  --blob-opacity: 0.5;
  --blob-blend: screen;
  --grain-opacity: 0.05;
  --grid-opacity: 0.35;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-0: #eef1fb;
  --bg-1: #f8f9ff;
  --text: #1a2244;
  --text-strong: #0b1130;
  --muted: #5c6788;
  --muted-dim: #8a93b1;

  --surface: rgba(255, 255, 255, 0.68);
  --surface-2: rgba(255, 255, 255, 0.85);
  --surface-3: rgba(255, 255, 255, 0.95);
  --stroke: rgba(20, 28, 60, 0.1);
  --stroke-strong: rgba(20, 28, 60, 0.2);
  --input-bg: rgba(255, 255, 255, 0.8);
  --card-shadow: 0 40px 80px -46px rgba(30, 40, 90, 0.55),
    0 10px 30px -18px rgba(124, 92, 255, 0.35);
  --blob-opacity: 0.34;
  --blob-blend: normal;
  --grain-opacity: 0.03;
  --grid-opacity: 0.5;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.4s ease;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

::selection {
  background: color-mix(in srgb, var(--brand-2) 45%, transparent);
}

/* --------------------------------------------------------------------------
   3. Ambient background — animated gradient, morphing blobs, grid, grain
   -------------------------------------------------------------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 12% 0%, color-mix(in srgb, var(--brand-1) 22%, transparent), transparent 60%),
    radial-gradient(90% 70% at 100% 8%, color-mix(in srgb, var(--brand-2) 20%, transparent), transparent 62%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 60%, var(--bg-0));
  background-size: 100% 100%, 100% 100%, 220% 220%;
  animation: gradientDrift 26s var(--ease-out) infinite alternate;
}

@keyframes gradientDrift {
  0% {
    background-position: 0% 0%, 100% 0%, 0% 50%;
  }
  50% {
    background-position: 20% 30%, 80% 20%, 60% 50%;
  }
  100% {
    background-position: 0% 20%, 100% 40%, 100% 50%;
  }
}

.blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 46% 54% 62% 38% / 48% 42% 58% 52%;
  filter: blur(72px);
  opacity: var(--blob-opacity);
  mix-blend-mode: var(--blob-blend);
  will-change: transform, border-radius;
}

.blob--1 {
  top: -18vmax;
  left: -12vmax;
  background: radial-gradient(circle at 35% 35%, var(--brand-1), transparent 66%);
  animation: morph 22s ease-in-out infinite, floatA 30s ease-in-out infinite;
}

.blob--2 {
  top: 22vmax;
  right: -20vmax;
  background: radial-gradient(circle at 45% 45%, var(--brand-2), transparent 66%);
  animation: morph 26s ease-in-out infinite reverse, floatB 34s ease-in-out infinite;
}

.blob--3 {
  bottom: -22vmax;
  left: 22vmax;
  background: radial-gradient(circle at 50% 50%, var(--brand-3), transparent 66%);
  animation: morph 30s ease-in-out infinite, floatC 28s ease-in-out infinite;
}

@keyframes morph {
  0%,
  100% {
    border-radius: 46% 54% 62% 38% / 48% 42% 58% 52%;
  }
  33% {
    border-radius: 62% 38% 42% 58% / 56% 62% 38% 44%;
  }
  66% {
    border-radius: 38% 62% 56% 44% / 62% 38% 56% 44%;
  }
}

@keyframes floatA {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(8vmax, 6vmax, 0) scale(1.08); }
}

@keyframes floatB {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
  50% { transform: translate3d(-9vmax, 7vmax, 0) scale(0.95); }
}

@keyframes floatC {
  0%, 100% { transform: translate3d(0, 0, 0) scale(0.96); }
  50% { transform: translate3d(6vmax, -8vmax, 0) scale(1.1); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  opacity: var(--grid-opacity);
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--text) 12%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--text) 12%, transparent) 1px, transparent 1px);
  background-size: 78px 78px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 20%, transparent 78%);
  animation: gridPan 40s linear infinite;
}

@keyframes gridPan {
  to {
    background-position: 78px 78px;
  }
}

.grain {
  position: absolute;
  inset: -50%;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 6s steps(6) infinite;
}

@keyframes grainShift {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-3%, 2%, 0); }
  50% { transform: translate3d(2%, -3%, 0); }
  75% { transform: translate3d(-2%, -2%, 0); }
  100% { transform: translate3d(3%, 1%, 0); }
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.app {
  width: min(760px, 100% - 2.5rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) 0 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* --------------------------------------------------------------------------
   5. Top bar
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: dropIn 0.8s var(--ease-out) both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.45s var(--ease-spring), box-shadow 0.45s var(--ease-out);
}

.brand__mark::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--gradient);
  opacity: 0.16;
  z-index: -1;
  filter: blur(10px);
  animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.12; transform: scale(1); }
  50% { opacity: 0.32; transform: scale(1.06); }
}

.brand:hover .brand__mark {
  transform: translateY(-2px) rotate(-6deg);
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--brand-1) 80%, transparent);
}

.brand__mark svg {
  width: 26px;
  height: 26px;
}

.brand__tick {
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: drawTick 0.9s var(--ease-out) 0.3s forwards;
}

@keyframes drawTick {
  to { stroke-dashoffset: 0; }
}

.brand__text {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
}

/* Theme toggle ------------------------------------------------------------ */
.theme-toggle {
  position: relative;
  width: 66px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--stroke-strong);
}

.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gradient);
  background-size: 200% 200%;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand-1) 90%, transparent);
  transition: transform 0.55s var(--ease-spring), background-position 0.6s ease;
}

html[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(32px);
}

.theme-toggle__icon {
  position: absolute;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.4s ease, transform 0.5s var(--ease-spring);
}

.theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(-70deg) scale(0.4);
}

html[data-theme="light"] .theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(70deg) scale(0.4);
}

html[data-theme="light"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   6. Card (glassmorphism)
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  isolation: isolate;
  padding: clamp(1.25rem, 3.4vw, 2rem);
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke);
  background: var(--surface);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  animation: cardIn 0.9s var(--ease-out) both 0.05s;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.97);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* animated gradient hairline border on top edge */
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--brand-1), var(--brand-2), var(--brand-3), transparent);
  background-size: 220% 100%;
  opacity: 0.8;
  animation: sweep 6s linear infinite;
}

@keyframes sweep {
  to { background-position: 220% 0; }
}

/* pointer-follow spotlight */
.card__spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    340px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--brand-2) 16%, transparent),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.card:hover .card__spotlight {
  opacity: 1;
}

/* Header ------------------------------------------------------------------ */
.card__head {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.35rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-dim);
  animation: riseIn 0.7s var(--ease-out) both 0.15s;
}

.title {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--text-strong);
  animation: riseIn 0.7s var(--ease-out) both 0.22s;
}

.title__gradient {
  background: var(--gradient);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hueSlide 7s ease-in-out infinite;
}

@keyframes hueSlide {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  animation: riseIn 0.7s var(--ease-out) both 0.3s;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Progress ---------------------------------------------------------------- */
.progress {
  position: relative;
  height: 8px;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
  animation: riseIn 0.7s var(--ease-out) both 0.38s;
}

.progress__fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--brand-1),
    var(--brand-2),
    var(--brand-3),
    var(--brand-2),
    var(--brand-1)
  );
  background-size: 300% 100%;
  box-shadow: 0 0 16px -2px color-mix(in srgb, var(--brand-2) 70%, transparent);
  transition: width 0.7s var(--ease-out);
  animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
  to { background-position: 300% 0; }
}

/* --------------------------------------------------------------------------
   7. Composer (input + add button)
   -------------------------------------------------------------------------- */
.composer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.5rem 0.5rem 0.9rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s var(--ease-out);
  animation: riseIn 0.7s var(--ease-out) both 0.45s;
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--brand-1) 60%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 18%, transparent),
    0 18px 40px -26px color-mix(in srgb, var(--brand-1) 90%, transparent);
  transform: translateY(-1px);
}

/* validation flash — the shake itself runs through the Web Animations API so it
   never competes with the composer's entrance animation */
.composer.is-invalid {
  border-color: #ff6b81;
  box-shadow: 0 0 0 4px rgba(255, 107, 129, 0.18);
}

.composer__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted);
  transition: transform 0.5s var(--ease-spring), color 0.3s ease;
}

.composer__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.composer:focus-within .composer__icon {
  color: var(--brand-2);
  transform: rotate(90deg) scale(1.1);
}

.composer__input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.2rem;
  border: 0;
  background: none;
  font-size: 1rem;
  color: var(--text-strong);
}

.composer__input::placeholder {
  color: var(--muted-dim);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.composer__input:focus::placeholder {
  opacity: 0.55;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.72rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  transition: transform 0.28s var(--ease-spring), box-shadow 0.35s ease, opacity 0.3s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  color: #fff;
  background: var(--gradient);
  background-size: 200% 200%;
  box-shadow: 0 14px 30px -16px color-mix(in srgb, var(--brand-1) 95%, transparent);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -18px color-mix(in srgb, var(--brand-2) 95%, transparent);
  background-position: 100% 50%;
}

.btn__label {
  position: relative;
  z-index: 2;
}

.btn__shine {
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  transition: left 0.75s var(--ease-out);
}

.btn--primary:hover .btn__shine {
  left: 140%;
}

.btn__ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.btn__ripple.is-on {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}

.btn--ghost {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--stroke);
  background: var(--surface);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text-strong);
  border-color: var(--stroke-strong);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

/* --------------------------------------------------------------------------
   8. Filters (sliding pill)
   -------------------------------------------------------------------------- */
.filters {
  position: relative;
  display: flex;
  gap: 0.25rem;
  margin: 1.3rem 0 0.9rem;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  animation: riseIn 0.7s var(--ease-out) both 0.5s;
}

.filters__pill {
  position: absolute;
  top: 0.3rem;
  left: 0; /* slid purely with transform — offsetLeft is measured from this edge */
  height: calc(100% - 0.6rem);
  width: 0;
  border-radius: 999px;
  background: var(--gradient);
  background-size: 200% 200%;
  box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--brand-1) 95%, transparent);
  transition: transform 0.5s var(--ease-spring), width 0.5s var(--ease-spring);
}

.filter {
  position: relative;
  z-index: 1;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.4rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.35s ease;
  white-space: nowrap;
}

.filter:hover {
  color: var(--text);
}

.filter.is-active {
  color: #fff;
}

.filter__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  padding: 0 0.35rem;
  height: 20px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  transition: background 0.35s ease, color 0.35s ease, transform 0.4s var(--ease-spring);
}

.filter.is-active .filter__count {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.filter__count.is-bumped {
  animation: pop 0.45s var(--ease-spring);
}

@keyframes pop {
  50% { transform: scale(1.35); }
}

/* --------------------------------------------------------------------------
   9. Task list
   -------------------------------------------------------------------------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.85rem 0.8rem 0.9rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.35s ease,
    background 0.35s ease, box-shadow 0.35s ease;
}

/* staggered entrance */
.item.is-new {
  animation: itemIn 0.6s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

.item:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
  background: var(--surface-2);
  box-shadow: 0 18px 34px -26px rgba(0, 0, 0, 0.8);
}

/* gradient accent bar that grows from the left on hover */
.item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 3px;
  border-radius: 999px;
  background: var(--gradient);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-out);
}

.item:hover::before,
.item.is-done::before {
  transform: scaleY(1);
}

.item.is-done {
  background: color-mix(in srgb, var(--brand-3) 8%, transparent);
}

.item.is-done::before {
  background: linear-gradient(var(--brand-3), var(--brand-1));
}

/* checkbox ---------------------------------------------------------------- */
.check {
  position: relative;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  border: 2px solid var(--stroke-strong);
  background: transparent;
  display: grid;
  place-items: center;
  transition: border-color 0.3s ease, background 0.35s ease, transform 0.35s var(--ease-spring);
}

.check:hover {
  transform: scale(1.1);
  border-color: var(--brand-2);
}

.check svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.check__tick {
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  transition: stroke-dashoffset 0.4s var(--ease-out) 0.08s;
}

.item.is-done .check {
  border-color: transparent;
  background: var(--gradient);
  background-size: 200% 200%;
  animation: checkPop 0.5s var(--ease-spring);
}

.item.is-done .check__tick {
  stroke-dashoffset: 0;
}

@keyframes checkPop {
  0% { transform: scale(0.8); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* text + animated strikethrough ------------------------------------------- */
.item__text {
  position: relative;
  flex: 1;
  min-width: 0;
  font-size: 0.98rem;
  line-height: 1.4;
  word-break: break-word;
  transition: color 0.35s ease, opacity 0.35s ease;
}

.item__text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  height: 1.6px;
  border-radius: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.42s var(--ease-out) 0.06s;
}

.item.is-done .item__text {
  color: var(--muted-dim);
}

.item.is-done .item__text::after {
  transform: scaleX(1);
}

/* inline editor */
.item__editor {
  flex: 1;
  min-width: 0;
  padding: 0.42rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--brand-1) 60%, transparent);
  background: var(--input-bg);
  font-size: 0.98rem;
  animation: editorIn 0.35s var(--ease-out);
}

@keyframes editorIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* row actions ------------------------------------------------------------- */
.item__actions {
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.35s ease, transform 0.35s var(--ease-out);
}

.item:hover .item__actions,
.item:focus-within .item__actions,
.item.is-editing .item__actions {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .item__actions {
    opacity: 1;
    transform: none;
  }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease,
    transform 0.3s var(--ease-spring);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  transform: translateY(-2px) scale(1.06);
  color: var(--text-strong);
  background: var(--surface-3);
  border-color: var(--stroke);
}

.icon-btn--edit:hover {
  color: var(--brand-1);
}

.icon-btn--del:hover {
  color: #ff6b81;
  background: color-mix(in srgb, #ff6b81 16%, transparent);
  border-color: color-mix(in srgb, #ff6b81 40%, transparent);
}

/* removal animation -------------------------------------------------------- */
.item.is-removing {
  pointer-events: none;
  animation: itemOut 0.42s var(--ease-out) forwards;
}

@keyframes itemOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 200px;
  }
  45% {
    opacity: 0;
    transform: translateX(60px) scale(0.94);
    filter: blur(4px);
    max-height: 200px;
  }
  100% {
    opacity: 0;
    transform: translateX(60px) scale(0.94);
    filter: blur(4px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: -0.55rem;
    border-width: 0;
  }
}

/* filter transitions */
.item.is-hiding {
  animation: itemHide 0.3s var(--ease-out) forwards;
}

@keyframes itemHide {
  from {
    opacity: 1;
    transform: none;
    max-height: 200px;
  }
  to {
    opacity: 0;
    transform: scale(0.96);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: -0.55rem;
  }
}

/* --------------------------------------------------------------------------
   10. Empty state — self-drawing SVG
   -------------------------------------------------------------------------- */
.empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.6rem 1rem 1.2rem;
  text-align: center;
}

.empty.is-visible {
  display: flex;
  animation: riseIn 0.6s var(--ease-out) both;
}

.empty__art {
  width: 168px;
  height: auto;
  margin-bottom: 0.4rem;
}

.art-ring {
  transform-origin: 100px 84px;
  animation: spin 26s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.art-card {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: drawTick 1.4s var(--ease-out) 0.15s forwards, bob 5s ease-in-out 1.6s infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.art-line {
  stroke-dasharray: 44;
  stroke-dashoffset: 44;
  animation: drawTick 0.7s var(--ease-out) forwards;
}

.art-line--1 { animation-delay: 0.6s; }
.art-line--2 { animation-delay: 0.78s; }
.art-line--3 { animation-delay: 0.96s; }

.art-tick {
  stroke-dasharray: 44;
  stroke-dashoffset: 44;
  animation: drawTick 0.6s var(--ease-spring) 1.15s forwards;
}

.empty__title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-strong);
}

.empty__text {
  margin: 0;
  max-width: 34ch;
  font-size: 0.87rem;
  line-height: 1.5;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   11. Card footer
   -------------------------------------------------------------------------- */
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--stroke);
  animation: riseIn 0.7s var(--ease-out) both 0.6s;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted-dim);
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--muted);
}

.footnote {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted-dim);
  animation: riseIn 0.7s var(--ease-out) both 0.7s;
}

/* --------------------------------------------------------------------------
   12. Toasts
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: min(320px, 82vw);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--surface-3);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.85);
  color: var(--text-strong);
  font-size: 0.85rem;
  font-weight: 600;
  animation: toastIn 0.45s var(--ease-spring) both;
}

.toast.is-leaving {
  animation: toastOut 0.32s var(--ease-out) forwards;
}

.toast__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand-2) 80%, transparent);
  flex: 0 0 auto;
}

.toast--warn .toast__dot {
  background: linear-gradient(#ffb457, #ff6b81);
}

.toast--success .toast__dot {
  background: linear-gradient(var(--brand-3), var(--brand-1));
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(28px) scale(0.94);
  }
}

/* --------------------------------------------------------------------------
   13. Confetti
   -------------------------------------------------------------------------- */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  overflow: hidden;
}

.confetti__bit {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  animation: confettiPop var(--dur, 1.2s) var(--ease-out) var(--delay, 0s) forwards;
}

.confetti__bit:nth-child(3n) {
  border-radius: 50%;
}

.confetti__bit:nth-child(4n) {
  width: 6px;
  height: 13px;
}

@keyframes confettiPop {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.4);
  }
  15% {
    opacity: 1;
    transform: translate3d(calc(var(--tx) * 0.25), calc(var(--ty) * 1.15), 0) rotate(calc(var(--rot) * 0.3)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--tx), calc(var(--ty) * -0.7 + 260px), 0) rotate(var(--rot)) scale(0.7);
  }
}

/* --------------------------------------------------------------------------
   14. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 620px) {
  .app {
    width: min(760px, 100% - 1.6rem);
    padding-top: 1.2rem;
  }

  .card {
    border-radius: 24px;
  }

  .composer {
    flex-wrap: wrap;
    padding: 0.55rem;
  }

  .composer__icon {
    display: none;
  }

  .composer__input {
    flex: 1 1 100%;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--stroke);
    margin-bottom: 0.5rem;
  }

  .btn--primary {
    flex: 1;
  }

  .hint {
    display: none;
  }

  .card__foot {
    justify-content: flex-end;
  }

  .item__actions {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   15. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.06s !important;
    scroll-behavior: auto !important;
  }

  .art-card,
  .art-line,
  .art-tick,
  .brand__tick {
    stroke-dashoffset: 0;
  }

  .item.is-new {
    animation: none;
  }
}
