/* 토스 스타일 디자인 토큰 */
:root {
  --blue: #3182f6;
  --blue-dark: #1b64da;
  --blue-light: #e8f3ff;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f6;
  --gray-200: #e5e8eb;
  --gray-300: #d1d6db;
  --gray-400: #b0b8c1;
  --gray-500: #8b95a1;
  --gray-600: #6b7684;
  --gray-700: #4e5968;
  --gray-800: #333d4b;
  --gray-900: #191f28;
  --red: #f04452;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 3px rgba(0, 23, 51, 0.04), 0 6px 16px rgba(0, 23, 51, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* 헤더 */
.header { margin-bottom: 24px; padding: 0 4px; }
.header-date { font-size: 14px; font-weight: 500; color: var(--gray-500); margin-bottom: 4px; }
.header-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--gray-900); }
.header-summary { margin-top: 6px; font-size: 15px; font-weight: 500; color: var(--blue); }

/* 입력 카드 */
.input-card {
  display: flex;
  gap: 8px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  transition: box-shadow 0.2s ease;
}
.input-card:focus-within {
  box-shadow: 0 0 0 2px var(--blue-light), var(--shadow-card);
}
.todo-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-900);
  padding: 12px 14px;
  background: transparent;
  min-width: 0;
}
.todo-input::placeholder { color: var(--gray-400); }

.add-btn {
  border: none;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  flex-shrink: 0;
}
.add-btn:hover:not(:disabled) { background: var(--blue-dark); }
.add-btn:active:not(:disabled) { transform: scale(0.97); }
.add-btn:disabled { background: var(--gray-200); color: var(--gray-400); cursor: default; }

/* 목록 */
.list-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.todo-list { list-style: none; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s ease;
  animation: slide-in 0.25s ease both;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--gray-50); }

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

/* 체크박스 */
.todo-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}
.todo-check svg {
  width: 13px;
  height: 13px;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s ease;
}
.todo-item.done .todo-check { background: var(--blue); border-color: var(--blue); }
.todo-item.done .todo-check svg { opacity: 1; transform: scale(1); }

/* 내용 */
.todo-content {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-800);
  word-break: break-all;
  transition: color 0.15s ease;
}
.todo-item.done .todo-content {
  color: var(--gray-400);
  text-decoration: line-through;
  text-decoration-color: var(--gray-300);
}

/* 삭제 버튼 */
.todo-delete {
  border: none;
  background: transparent;
  color: var(--gray-400);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: all 0.15s ease;
}
.todo-item:hover .todo-delete,
.todo-delete:focus-visible { opacity: 1; }
.todo-delete:hover { background: #fdecee; color: var(--red); }
@media (hover: none) { .todo-delete { opacity: 1; } }

/* 빈 상태 / 오류 상태 */
.empty-state { padding: 56px 20px; text-align: center; }
.empty-emoji { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--gray-700); margin-bottom: 4px; }
.empty-desc { font-size: 14px; color: var(--gray-500); }

.retry-btn {
  margin-top: 16px;
  border: none;
  background: var(--blue-light);
  color: var(--blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}
.retry-btn:hover { background: #d9ebff; }

/* 토스트 */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--gray-800);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 23, 51, 0.2);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 접근성 */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

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