:root {
  color-scheme: light;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --ink: #172033;
  --muted: #71809a;
  --border: #e7edf6;
  --success: #22b7a0;
  --danger: #ef5f70;
  --surface: rgba(255, 255, 255, 0.92);
  --shadow: 0 24px 64px rgba(50, 91, 158, 0.14), 0 3px 12px rgba(70, 101, 151, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #edf6ff;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100% - 40px, 920px);
  margin: 0 auto;
  padding: 64px 0;
}

.app-header {
  margin: 0 0 30px;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 49px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.subtitle {
  margin: 10px 0 0;
  color: #56657d;
  font-size: 17px;
  font-weight: 560;
}

.todo-card {
  position: relative;
  overflow: hidden;
  padding: 48px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.add-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.input-wrap {
  display: flex;
  min-width: 0;
  height: 58px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-color: #cddcf0;
  border-radius: 13px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-wrap:focus-within {
  border-color: #8bbaff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.input-wrap svg,
.add-button svg,
.footer-note svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.input-wrap svg {
  color: #82a9dc;
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
}

.input-wrap input::placeholder {
  color: #9baac0;
}

.add-button {
  display: inline-flex;
  height: 58px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 154px;
  padding: 0 24px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: #1974e9;
  box-shadow: 0 8px 18px rgba(45, 111, 234, 0.24);
  cursor: pointer;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.add-button:hover {
  filter: saturate(1.08) brightness(1.03);
  box-shadow: 0 11px 24px rgba(45, 111, 234, 0.3);
  transform: translateY(-1px);
}

.add-button:active {
  box-shadow: 0 5px 12px rgba(45, 111, 234, 0.24);
  transform: translateY(1px);
}

.add-button:focus-visible,
.delete-button:focus-visible,
.task-checkbox:focus-visible + .custom-checkbox {
  outline: 3px solid rgba(59, 130, 246, 0.22);
  outline-offset: 3px;
}

.add-button svg {
  display: none;
}

.input-hint {
  min-height: 17px;
  margin: 6px 2px 0;
  color: var(--danger);
  font-size: 12px;
}

.input-wrap.invalid {
  border-color: rgba(239, 95, 112, 0.58);
  animation: shake 260ms ease;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 78px;
  padding: 17px 30px;
  border-radius: 14px;
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 11px;
}

.stat-open {
  background: #eef6ff;
}

.stat-open .stat-icon {
  color: #1475eb;
  background: transparent;
}

.stat-done {
  background: #ebfaf6;
}

.stat-done .stat-icon {
  color: #1ca18e;
  background: transparent;
}

.stat-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
}

.stat-item > div {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-left: 24px;
  border-left: 1px solid #cbdced;
}

.stat-label {
  color: #5f6f86;
  font-size: 16px;
  font-weight: 600;
}

.stat-item strong {
  color: #1475eb;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.stat-done strong {
  color: #16aa8a;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  margin: 28px 0 26px;
}

.progress-wrap {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #e3ebf5;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: #20b991;
  transition: width 350ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.progress-row strong {
  min-width: 42px;
  color: #68778e;
  font-size: 14px;
  text-align: right;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 3px 16px;
  color: #8794a8;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.list-header span:first-child {
  color: #152239;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.todo-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 14px 8px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  animation: item-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: border-color 160ms ease, background 160ms ease, opacity 180ms ease, transform 180ms ease;
}

.todo-item:hover {
  background: #f9fbfe;
}

.todo-item:last-child {
  border-bottom: 0;
}

.todo-item.completed {
  background: #fafcff;
}

.todo-item.removing {
  opacity: 0;
  transform: translateX(12px) scale(0.98);
}

.check-control {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: 23px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  cursor: pointer;
}

.task-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.custom-checkbox {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid #c8d8ea;
  border-radius: 7px;
  color: #fff;
  background: #fff;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.custom-checkbox svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  transition: stroke-dashoffset 200ms ease;
}

.task-checkbox:checked + .custom-checkbox {
  border-color: var(--blue-500);
  background: linear-gradient(145deg, #54a0ff, #2d78ed);
  box-shadow: 0 4px 10px rgba(45, 120, 237, 0.2);
  transform: scale(1.03);
}

.task-checkbox:checked + .custom-checkbox svg {
  stroke-dashoffset: 0;
}

.task-text {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #354158;
  font-size: 15px;
  line-height: 1.45;
  transition: color 180ms ease, opacity 180ms ease;
}

.completed .task-text {
  color: #9ba6b7;
  opacity: 0.8;
  text-decoration: line-through;
  text-decoration-color: #aeb8c6;
  text-decoration-thickness: 1.5px;
}

.delete-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: #a5b0c0;
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.delete-button:hover {
  color: var(--danger);
  background: #fff0f2;
  transform: rotate(3deg);
}

.delete-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.empty-state {
  padding: 30px 16px 24px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-illustration {
  position: relative;
  width: 92px;
  height: 78px;
  margin: 0 auto 16px;
  border: 1px solid #cfe1f8;
  border-radius: 18px;
  background: linear-gradient(150deg, #fff, #eff7ff);
  box-shadow: 0 10px 24px rgba(73, 124, 190, 0.1);
  transform: rotate(-3deg);
}

.paper-line {
  position: absolute;
  left: 17px;
  height: 5px;
  border-radius: 99px;
  background: #d8e8fb;
}

.line-one { top: 20px; width: 45px; }
.line-two { top: 34px; width: 55px; }
.line-three { top: 48px; width: 36px; }

.empty-check {
  position: absolute;
  right: -9px;
  bottom: -8px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #58d4c0, #22ad9a);
  box-shadow: 0 5px 13px rgba(34, 173, 154, 0.25);
}

.empty-check svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: #445168;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  color: #98a5b8;
  font-size: 13px;
}

.footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 28px 0 0;
  padding-top: 22px;
  border-top: 1px solid #dfe8f3;
  color: #8e9db3;
  font-size: 12px;
}

.footer-note svg {
  width: 16px;
  height: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes item-in {
  from { opacity: 0; transform: translateY(-7px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  65% { transform: translateX(4px); }
}

@media (max-width: 600px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 18px 0;
  }

  .app-header {
    margin-bottom: 24px;
  }

  .subtitle {
    font-size: 13px;
  }

  .todo-card {
    padding: 26px 20px;
    border-radius: 23px;
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .add-button {
    width: 100%;
  }

  .stats {
    gap: 10px;
  }

  .stat-item {
    gap: 5px;
    min-height: 70px;
    padding: 12px 10px;
  }

  .stat-icon {
    width: 31px;
    height: 31px;
  }

  .stat-item > div {
    display: grid;
    gap: 0;
    padding-left: 10px;
  }

  .stat-item strong {
    order: -1;
    font-size: 20px;
  }

  .stat-label {
    font-size: 11px;
  }

  .progress-row {
    margin: 22px 0;
  }

  .list-header span:first-child {
    font-size: 20px;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 31px;
  }

  .stat-icon {
    display: none;
  }

  .stat-item > div {
    width: 100%;
    padding-left: 0;
    border-left: 0;
    text-align: center;
  }
}

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