:root {
  --font-base: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --radius-card: 16px;
  --shadow-card: 0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px -1px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 12px 0 rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.card {
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-card);
}

/* Filter buttons */
.filter-btn {
  color: #64748b;
  background: transparent;
}
.filter-btn:hover {
  color: #1e293b;
  background: #f8fafc;
}
.filter-btn.active-filter {
  color: #4f46e5;
  background: #eef2ff;
}

/* Task item card */
.task-item {
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.2s ease, transform 0.2s ease;
  will-change: opacity, transform;
}

.task-item:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #e2e8f0;
}

.task-item.task-entering {
  animation: taskSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.task-item.task-leaving {
  animation: taskFadeOut 0.22s ease forwards;
}

@keyframes taskSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes taskFadeOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 80px;
    margin-bottom: 0.625rem;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
  }
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
  }
}

/* Custom checkbox */
.task-checkbox-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
.task-checkbox-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #eef2ff;
}
.task-checkbox-btn:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #c7d2fe;
}
.task-checkbox-btn.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.task-checkbox-btn .check-icon {
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.task-checkbox-btn.checked .check-icon {
  opacity: 1;
  transform: scale(1);
}

/* Task text */
.task-text {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #1e293b;
  font-weight: 450;
  word-break: break-word;
  transition: color 0.2s ease;
}
.task-text.completed {
  color: #94a3b8;
  text-decoration: line-through;
  text-decoration-color: #cbd5e1;
}

/* Edit input */
.task-edit-input {
  flex: 1;
  background: #f8fafc;
  border: 1.5px solid #818cf8;
  border-radius: 8px;
  padding: 0.25rem 0.625rem;
  font-size: 0.9375rem;
  font-family: var(--font-base);
  color: #1e293b;
  outline: none;
  box-shadow: 0 0 0 3px #eef2ff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.task-edit-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #c7d2fe;
}

/* Action icon buttons */
.task-action-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  color: #94a3b8;
  cursor: pointer;
  background: transparent;
  border: none;
}

.task-item:hover .task-action-btn,
.task-item:focus-within .task-action-btn {
  opacity: 1;
}

.task-action-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

.task-action-btn.delete-btn:hover {
  background: #fef2f2;
  color: #ef4444;
}
.task-action-btn.save-btn:hover {
  background: #f0fdf4;
  color: #22c55e;
}
.task-action-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Add button */
.add-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Progress bar */
.progress-track {
  height: 4px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.625rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toast */
.toast {
  pointer-events: auto;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-base);
  padding: 0.625rem 1.125rem;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  white-space: nowrap;
  animation: toastIn 0.2s ease forwards;
}
.toast.toast-out {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(4px) scale(0.97); }
}

/* Empty state */
#empty-state {
  display: none;
}
#empty-state.show {
  display: flex;
}

/* Bulk actions */
#bulk-actions {
  display: none;
}
#bulk-actions.show {
  display: flex;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .task-item,
  .task-item.task-entering,
  .task-item.task-leaving,
  .toast,
  .toast.toast-out,
  .progress-fill,
  .task-checkbox-btn,
  .task-checkbox-btn .check-icon {
    animation: none !important;
    transition: none !important;
  }
}
