:root {
  --bg-1: #eef2ff;
  --bg-2: #fdf2f8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #6366f1;
  --accent-2: #ec4899;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --danger: #ef4444;
  --shadow: 0 30px 60px -20px rgba(30, 41, 59, 0.25), 0 0 0 1px var(--border);
  --radius: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #0b1020;
    --bg-2: #1a1033;
    --surface: rgba(17, 24, 39, 0.78);
    --surface-solid: #111827;
    --border: rgba(255, 255, 255, 0.08);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent-soft: rgba(129, 140, 248, 0.16);
    --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(24px, 8vh, 96px) 16px 48px;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.25), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(236, 72, 153, 0.2), transparent 40%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

.card {
  width: 100%;
  max-width: 560px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.ring {
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 3.2;
}

.ring__track {
  stroke: var(--accent-soft);
}

.ring__value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  opacity: 0;
  transition: stroke-dasharray 0.4s ease, opacity 0.2s;
}

.composer {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.composer input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}

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

.btn--primary {
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -8px var(--accent);
}

.btn--ghost {
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.filters {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.filter {
  padding: 6px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.filter[aria-pressed='true'] {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.todo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}

.todo.is-new {
  animation: slide-in 0.2s ease;
}

.todo:last-child {
  border-bottom: none;
}

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

.todo__check {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.todo__check input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.todo__box {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.todo__box svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 0.25s ease;
}

.todo__check input:checked + .todo__box {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.todo__check input:checked + .todo__box svg {
  stroke-dashoffset: 0;
}

.todo__check input:focus-visible + .todo__box {
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.todo__title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.4;
  transition: color 0.2s;
}

.todo.is-completed .todo__title {
  color: var(--muted);
  text-decoration: line-through;
}

.todo__edit {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--surface-solid);
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.todo__delete {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.todo__delete svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.todo:hover .todo__delete,
.todo__delete:focus-visible {
  opacity: 1;
}

.todo__delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

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

.empty {
  padding: 36px 0 28px;
  text-align: center;
}

.empty__icon {
  font-size: 2rem;
}

.empty__title {
  margin: 8px 0 4px;
  font-weight: 600;
}

.empty__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(239, 68, 68, 0.7);
}
