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

:root {
  --bg: #050816;
  --bg-soft: #0b1220;
  --accent: #22c55e;
  --accent-2: #6366f1;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --radius-xl: 1.25rem;
  --radius-lg: 1rem;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #111827 0, #020617 45%, #000 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  justify-content: center;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(32px);
  opacity: 0.9;
  z-index: -1;
}

body::before {
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.25), transparent 60%);
}

body::after {
  bottom: -140px;
  right: -80px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 60%);
}

.page-shell {
  width: 100%;
  max-width: 720px;
  padding: 1.8rem 1.5rem 2.5rem;
}

/* HEADER */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.6rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.back-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.app-kicker {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.app-header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.15rem;
}

.app-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

/* CARD */
.todo-card {
  margin-top: 0.3rem;
  background: rgba(15, 23, 42, 0.98);
  border-radius: var(--radius-xl);
  padding: 1.4rem 1.5rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

.todo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.todo-header h2 {
  font-size: 1.2rem;
}

.todo-counter {
  font-size: 0.85rem;
  color: var(--muted);
}

/* PROGRESS */
.progress-shell {
  width: 200px;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  text-align: right;
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease-out;
}

/* FORM */
.todo-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.todo-input-group {
  display: flex;
  flex: 1;
  gap: 0.4rem;
}

.todo-input {
  flex: 1.6;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.95rem;
}

.todo-input::placeholder {
  color: #6b7280;
}

.todo-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.todo-select,
.todo-date {
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  font-size: 0.85rem;
}

.todo-select:focus,
.todo-date:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-add {
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  background: radial-gradient(circle at 20% 0, #4ade80, var(--accent));
  color: #022c22;
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.5);
  white-space: nowrap;
}

.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(34, 197, 94, 0.6);
}

/* TOOLBAR */
.todo-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.filters {
  display: inline-flex;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.9);
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.filter-btn {
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}

.filter-btn.is-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--text);
}

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

.toolbar-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.todo-clear-done,
.todo-clear-all {
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  transition: 0.15s ease;
  backdrop-filter: blur(6px);
}

.todo-clear-all {
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
  color: #fda4af;
}

.todo-clear-done:hover,
.todo-clear-all:hover {
  background: rgba(244, 63, 94, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

/* LIST */
.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.3rem;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.8rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.todo-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
}

.todo-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.todo-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.todo-text {
  font-size: 0.92rem;
}

.todo-item.is-done .todo-text {
  text-decoration: line-through;
  color: #6b7280;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.75rem;
}

.pill {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.pill-category {
  border-color: rgba(34, 197, 94, 0.7);
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
}

.pill-deadline {
  border-color: rgba(129, 140, 248, 0.8);
  background: rgba(79, 70, 229, 0.18);
  color: #c7d2fe;
}

.todo-delete {
  border: none;
  background: transparent;
  color: #fca5a5;
  font-size: 0.85rem;
  cursor: pointer;
}

.todo-delete:hover {
  color: #fecaca;
}

.todo-empty {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.6rem 0.2rem;
}

/* NOTE */
.small-note {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* RESPONSIVE */
@media (max-width: 700px) {
  .page-shell {
    padding-inline: 1.1rem;
  }

  .todo-header {
    flex-direction: column;
    align-items: stretch;
  }

  .progress-shell {
    width: 100%;
  }

  .progress-label {
    text-align: left;
  }
}

@media (max-width: 600px) {
  .todo-form {
    flex-direction: column;
  }

  .todo-input-group {
    flex-direction: column;
  }

  .btn-add {
    width: 100%;
    justify-content: center;
  }

  .todo-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .todo-item {
    align-items: flex-start;
  }
}
