*, *::before, *::after { box-sizing: border-box; }
img, svg, video { max-width: 100%; }
img { height: auto; }

html, body { overflow-x: hidden; }
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

:root {
  --indigo: #4F46E5;
  --amber: #F59E0B;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- 진행률 ---------- */
.progress-fill {
  transition: width 700ms var(--ease-out), background-color 300ms ease;
  background-image: linear-gradient(90deg, #6366F1, #4F46E5);
}
.progress-fill.is-complete { background-image: linear-gradient(90deg, #4F46E5, #10B981); }

/* ---------- 탭 ---------- */
.tab-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 40px; padding: 0 .9rem; border-radius: .65rem;
  font-size: .875rem; font-weight: 600; color: #475569; white-space: nowrap;
  transition: background-color 150ms, color 150ms, box-shadow 150ms;
}
.tab-btn:hover { color: #0f172a; }
.tab-btn:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.tab-btn[aria-selected="true"] { background: #fff; color: var(--indigo); box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 1px 1px rgba(15,23,42,.04); }
.tab-count {
  min-width: 1.35rem; padding: 0 .35rem; border-radius: 999px;
  font-size: .72rem; line-height: 1.35rem; text-align: center;
  background: #e2e8f0; color: #475569;
}
.tab-btn[aria-selected="true"] .tab-count { background: #EEF2FF; color: var(--indigo); }

/* ---------- 할 일 항목 ---------- */
.todo { will-change: transform; }
.todo-content { transition: opacity 400ms ease; }
.todo-title { transition: color 300ms ease; text-decoration-thickness: 1.5px; }
.todo.is-done .todo-content { opacity: .5; }
.todo.is-done .todo-title { text-decoration: line-through; color: #64748b; }
.todo.is-starred { border-color: #FDE68A; box-shadow: 0 1px 2px rgba(245,158,11,.08); }

.todo.enter { animation: enter 320ms var(--ease-out); }
.todo.leave { animation: leave 260ms ease forwards; pointer-events: none; }
.todo.flash-done .todo-content { animation: doneFade 500ms ease; }

@keyframes enter { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateX(16px); } }
@keyframes doneFade { 0% { opacity: 1; } 100% { opacity: .5; } }

/* 체크박스 */
.check-box {
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: .5rem;
  border: 2px solid #cbd5e1; background: #fff; color: #fff;
  transition: background-color 200ms, border-color 200ms, transform 150ms;
}
.check-box svg { opacity: 0; transform: scale(.6); transition: opacity 200ms, transform 200ms var(--ease-out); }
.check-wrap:hover .check-box { border-color: #818cf8; }
.check-input:checked + .check-box { background: var(--indigo); border-color: var(--indigo); }
.check-input:checked + .check-box svg { opacity: 1; transform: scale(1); }
.check-input:focus-visible + .check-box { outline: 2px solid var(--indigo); outline-offset: 3px; }
.check-wrap:active .check-box { transform: scale(.92); }

/* 별 */
.star-btn { color: #cbd5e1; transition: color 150ms, background-color 150ms; }
.star-btn:hover { color: #FBBF24; background: #FFFBEB; }
.star-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.star-btn svg { fill: transparent; transition: fill 150ms; }
.star-btn[aria-pressed="true"] { color: var(--amber); }
.star-btn[aria-pressed="true"] svg { fill: var(--amber); }
.star-btn.pop svg { animation: pop 380ms var(--ease-out); }
@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.4) rotate(-12deg); }
  70% { transform: scale(.92) rotate(4deg); }
  100% { transform: scale(1); }
}

.del-btn { color: #94a3b8; transition: color 150ms, background-color 150ms; }
.del-btn:hover { color: #e11d48; background: #FFF1F2; }
.del-btn:focus-visible { outline: 2px solid #e11d48; outline-offset: 1px; }

/* 빈 상태 */
.empty { display: none; }
.empty.is-visible { display: block; animation: enter 300ms var(--ease-out); }

/* 남은 할 일 바 */
.remain-fill { transition: width 600ms var(--ease-out); }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: .75rem 1.1rem; border-radius: .85rem;
  background: #0f172a; color: #fff; font-size: .9rem; font-weight: 500;
  box-shadow: 0 10px 30px rgba(15,23,42,.2);
  transition: opacity 200ms, transform 200ms var(--ease-out);
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-left: .75rem; color: #a5b4fc; font-weight: 700; }
.toast button:hover { color: #c7d2fe; }

#titleError.is-visible { display: flex; }

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